com php-src: more zpp fixes: ext/mysqli/mysqli_api.c
| From: | Anatol Belski | Date: | Sun, 02 Mar 2014 10:10:27 +0000 |
| Subject: | com php-src: more zpp fixes: ext/mysqli/mysqli_api.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76304@lists.php.net to get a copy of this message | ||
Commit: 549b2516913e3a163ec3b42373c612bfdef03f86
Author: Anatol Belski <ab@php.net> Sun, 2 Mar 2014 11:10:27 +0100
Parents: 16e4b43f8c19d1df9efc0da8e7bd9059b1e01593
Branches: str_size_and_int64_56_backport
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=549b2516913e3a163ec3b42373c612bfdef03f86
Log:
more zpp fixes
Changed paths:
M ext/mysqli/mysqli_api.c
Diff:
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index e606e38..530eadc 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -2306,7 +2306,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
my_bool mode_b;
#endif
php_uint_t mode;
- php_uint_t attr;
+ php_int_t attr;
void *mode_p;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii",
&mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
@@ -2319,6 +2319,11 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
RETURN_FALSE;
}
+ if (attr < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "attr should be non-negative, %pd passed",
attr);
+ RETURN_FALSE;
+ }
+
switch (attr) {
#if MYSQL_VERSION_ID >= 50107
case STMT_ATTR_UPDATE_MAX_LENGTH:
@@ -2349,12 +2354,18 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
MY_STMT *stmt;
zval *mysql_stmt;
php_uint_t value = 0;
- php_uint_t attr;
+ php_int_t attr;
int rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi",
&mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
return;
}
+
+ if (attr < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "attr should be non-negative, %pd passed",
attr);
+ RETURN_FALSE;
+ }
+
MYSQLI_FETCH_RESOURCE_STMT(stmt, &mysql_stmt, MYSQLI_STATUS_VALID);
if ((rc = mysql_stmt_attr_get(stmt->stmt, attr, &value))) {