Skip to content

Commit d0d978b

Browse files
author
BRANDON KIRSCH
committed
php_odbc_fetch_hash() Fixed a segfault when fetching certain SQL NULLs
php_odbc.c:1774 Changed the conditional to include the check: && Z_TYPE_P(tmp) != IS_NULL This prevents a potential segfault on 1775 where zend_hash_update is called with Z_STR*(tmp) args. Fixes Bug https://bugs.php.net/bug.php?id=61387
1 parent 0cc0f73 commit d0d978b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/odbc/php_odbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
17711771
if (result_type & ODBC_NUM) {
17721772
zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(zval *), NULL);
17731773
} else {
1774-
if (!*(result->values[i].name)) {
1774+
if (!*(result->values[i].name) && Z_TYPE_P(tmp) != IS_NULL) {
17751775
zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)+1, &tmp, sizeof(zval *), NULL);
17761776
} else {
17771777
zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(zval *), NULL);

0 commit comments

Comments
 (0)