mirror of
https://github.com/php/php-src.git
synced 2026-03-26 09:12:14 +01:00
off by one error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.5 on Thu May 20 13:12:59 2004 */
|
||||
/* Generated by re2c 0.5 on Thu May 20 13:51:55 2004 */
|
||||
#line 1 "/home/george/src/pecl/pdo/pdo_sql_parser.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -232,12 +232,14 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
if(!params) {
|
||||
/* error */
|
||||
efree(*outquery);
|
||||
*outquery = NULL;
|
||||
return (int) (s.cur - inquery);
|
||||
}
|
||||
/* lookup bind first via hash and then index */
|
||||
/* stupid keys need to be null-terminated, even though we know their length */
|
||||
crutch = s.tok[s.cur-s.tok + 1];
|
||||
crutch = s.tok[s.cur-s.tok];
|
||||
s.tok[s.cur-s.tok] = '\0';
|
||||
fprintf(stderr, "looking up key: (%.*s)", s.cur-s.tok + 1, s.tok);
|
||||
if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok + 1,(void **)¶m))
|
||||
||
|
||||
(SUCCESS == zend_hash_index_find(params, bindno, (void **)¶m)))
|
||||
@@ -265,6 +267,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
else {
|
||||
/* error and cleanup */
|
||||
efree(*outquery);
|
||||
*outquery = NULL;
|
||||
return (int) (s.cur - inquery);
|
||||
}
|
||||
bindno++;
|
||||
@@ -273,6 +276,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
if(!params) {
|
||||
/* error */
|
||||
efree(*outquery);
|
||||
*outquery = NULL;
|
||||
return (int) (s.cur - inquery);
|
||||
}
|
||||
/* lookup bind by index */
|
||||
@@ -299,12 +303,14 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
else {
|
||||
/* error and cleanup */
|
||||
efree(*outquery);
|
||||
*outquery = NULL;
|
||||
return (int) (s.cur - inquery);
|
||||
}
|
||||
bindno++;
|
||||
}
|
||||
}
|
||||
*ptr = '\0';
|
||||
fprintf(stderr, "good\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
}
|
||||
/* lookup bind first via hash and then index */
|
||||
/* stupid keys need to be null-terminated, even though we know their length */
|
||||
crutch = s.tok[s.cur-s.tok + 1];
|
||||
crutch = s.tok[s.cur-s.tok];
|
||||
s.tok[s.cur-s.tok] = '\0';
|
||||
if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok + 1,(void **)¶m))
|
||||
||
|
||||
@@ -147,7 +147,7 @@ int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **ou
|
||||
*outquery_len += (Z_STRLEN_P(param->parameter));
|
||||
}
|
||||
}
|
||||
else_{
|
||||
else {
|
||||
/* error and cleanup */
|
||||
efree(*outquery);
|
||||
*outquery = NULL;
|
||||
|
||||
Reference in New Issue
Block a user