Skip to content

Commit 383fcb3

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_STRING This avoids a potential segfault on 1775 where ZSTR_ macros are used when the ZVAL is sometimes NULL.
1 parent d0d978b commit 383fcb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/odbc/php_odbc.c

+1-1
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) && Z_TYPE_P(tmp) != IS_NULL) {
1774+
if (!*(result->values[i].name) && Z_TYPE_P(tmp) == IS_STRING) {
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)