diff options
author | Edin Kadribasic <edink@php.net> | 2005-02-06 00:46:17 +0000 |
---|---|---|
committer | Edin Kadribasic <edink@php.net> | 2005-02-06 00:46:17 +0000 |
commit | 0d9b0606b967322611fee22c6776f2cde896642e (patch) | |
tree | f36cad8367de7152a8d9f4fbbed25a14594cf81f /ext/pdo/pdo_sql_parser.c | |
parent | bf77a39349b4180ba871ee72bfdb9ba0ab7bf49f (diff) | |
download | php-git-0d9b0606b967322611fee22c6776f2cde896642e.tar.gz |
Don't segault when we have placeholders but no bound params
Diffstat (limited to 'ext/pdo/pdo_sql_parser.c')
-rw-r--r-- | ext/pdo/pdo_sql_parser.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index 10484f059b..ece456c0a5 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -1,5 +1,5 @@ -/* Generated by re2c 0.9.3 on Thu Jan 20 22:49:12 2005 */ -#line 1 "pdo_sql_parser.re" +/* Generated by re2c 0.9.3 on Sun Feb 6 01:46:44 2005 */ +#line 1 "pdo_sql_parser.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -275,6 +275,13 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, params = stmt->bound_params; + /* Do we have placeholders but no bound params */ + if (bindno && !params) { + strcpy(stmt->error_code, "HY093"); /* invalid parameter number */ + ret = -1; + goto clean_up; + } + /* what are we going to do ? */ if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { |