aboutsummaryrefslogtreecommitdiffstats
path: root/databases/php5-pdo
diff options
context:
space:
mode:
authorale <ale@FreeBSD.org>2012-06-13 17:57:17 +0800
committerale <ale@FreeBSD.org>2012-06-13 17:57:17 +0800
commit0dbf3957f2447237137e13c56e1e6ae3aa0627bd (patch)
tree55f024c38ff08d3b9e4d66c52331f0efc81ac630 /databases/php5-pdo
parent7e8c3a58951c325c0190ae867d8241466aa2301a (diff)
downloadfreebsd-ports-gnome-0dbf3957f2447237137e13c56e1e6ae3aa0627bd.tar.gz
freebsd-ports-gnome-0dbf3957f2447237137e13c56e1e6ae3aa0627bd.tar.zst
freebsd-ports-gnome-0dbf3957f2447237137e13c56e1e6ae3aa0627bd.zip
Fix a parsing bug in the prepared statements that can lead to access violations.
Obtained from: PHP git repo
Diffstat (limited to 'databases/php5-pdo')
-rw-r--r--databases/php5-pdo/Makefile1
-rw-r--r--databases/php5-pdo/files/patch-pdo_sql_parser.re42
2 files changed, 43 insertions, 0 deletions
diff --git a/databases/php5-pdo/Makefile b/databases/php5-pdo/Makefile
index 76f31572786d..b2db17b371ea 100644
--- a/databases/php5-pdo/Makefile
+++ b/databases/php5-pdo/Makefile
@@ -5,6 +5,7 @@
# $FreeBSD$
#
+PORTREVISION= 1
CATEGORIES= databases
MASTERDIR= ${.CURDIR}/../../lang/php5
diff --git a/databases/php5-pdo/files/patch-pdo_sql_parser.re b/databases/php5-pdo/files/patch-pdo_sql_parser.re
new file mode 100644
index 000000000000..eb16ad277e80
--- /dev/null
+++ b/databases/php5-pdo/files/patch-pdo_sql_parser.re
@@ -0,0 +1,42 @@
+--- pdo_sql_parser.re.orig
++++ pdo_sql_parser.re
+@@ -32,12 +32,12 @@
+
+ #define YYCTYPE unsigned char
+ #define YYCURSOR cursor
+-#define YYLIMIT cursor
++#define YYLIMIT s->end
+ #define YYMARKER s->ptr
+-#define YYFILL(n)
++#define YYFILL(n) { RET(PDO_PARSER_EOI); }
+
+ typedef struct Scanner {
+- char *ptr, *cur, *tok;
++ char *ptr, *cur, *tok, *end;
+ } Scanner;
+
+ static int scan(Scanner *s)
+@@ -51,7 +51,6 @@ static int scan(Scanner *s)
+ COMMENTS = ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|"--"[^\r\n]*);
+ SPECIALS = [:?"'];
+ MULTICHAR = [:?];
+- EOF = [\000];
+ ANYNOEOF = [\001-\377];
+ */
+
+@@ -64,7 +63,6 @@ static int scan(Scanner *s)
+ SPECIALS { SKIP_ONE(PDO_PARSER_TEXT); }
+ COMMENTS { RET(PDO_PARSER_TEXT); }
+ (ANYNOEOF\SPECIALS)+ { RET(PDO_PARSER_TEXT); }
+- EOF { RET(PDO_PARSER_EOI); }
+ */
+ }
+
+@@ -94,6 +92,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len,
+
+ ptr = *outquery;
+ s.cur = inquery;
++ s.end = inquery + inquery_len + 1;
+
+ /* phase 1: look for args */
+ while((t = scan(&s)) != PDO_PARSER_EOI) {