From: Andrey Hristov Date: Thu, 27 May 2010 12:44:10 +0000 (+0000) Subject: Check before use, because mysqlnd can return NULL X-Git-Tag: php-5.3.3RC1~116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3aa95c59cc59822f3b3fac52c73d7613d6771c77;p=php Check before use, because mysqlnd can return NULL and this will crash. However, this can happen only in case of OOM. --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 6615b7024f..6150f7179d 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -453,10 +453,13 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, { 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 /* }}} */