andrey Thu, 27 May 2010 12:44:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=299849
Log: Check before use, because mysqlnd can return NULL and this will crash. However, this can happen only in case of OOM. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-05-27 12:39:12 UTC (rev 299848) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-05-27 12:44:10 UTC (rev 299849) @@ -453,10 +453,13 @@ { unsigned int i; MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind(stmt->stmt); - for (i = 0; i < (argc - start); i++) { - params[i].zv = *(args[i + start]); + if (params) { + for (i = 0; i < (argc - start); i++) { + params[i].zv = *(args[i + start]); + } + return mysqlnd_stmt_bind_result(stmt->stmt, params); } - return mysqlnd_stmt_bind_result(stmt->stmt, params); + return FAIL; } #endif /* }}} */ Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-27 12:39:12 UTC (rev 299848) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-27 12:44:10 UTC (rev 299849) @@ -453,10 +453,13 @@ { unsigned int i; MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind(stmt->stmt); - for (i = 0; i < (argc - start); i++) { - params[i].zv = *(args[i + start]); + if (params) { + for (i = 0; i < (argc - start); i++) { + params[i].zv = *(args[i + start]); + } + return mysqlnd_stmt_bind_result(stmt->stmt, params); } - return mysqlnd_stmt_bind_result(stmt->stmt, params); + return FAIL; } #endif /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php