From: Bob Weinand Date: Fri, 15 May 2015 00:42:11 +0000 (+0200) Subject: Minor typo in warning message X-Git-Tag: PRE_PHP7_NSAPI_REMOVAL~42^2~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00ea48ad43122c67c904965d4c315237740685ea;p=php Minor typo in warning message --- diff --git a/ext/zlib/tests/dictionary_usage.phpt b/ext/zlib/tests/dictionary_usage.phpt index b73cd52d25..8ffa9e8bcd 100644 --- a/ext/zlib/tests/dictionary_usage.phpt +++ b/ext/zlib/tests/dictionary_usage.phpt @@ -21,5 +21,5 @@ var_dump(inflate_add($r, $a, ZLIB_FINISH)); string(%d) "%s" string(6) "abdcde" -Warning: inflate_add(): dictionary does match expected dictionary (incorrect adler32 hash) in %s on line %d +Warning: inflate_add(): dictionary does not match expected dictionary (incorrect adler32 hash) in %s on line %d bool(false) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index f09ba00cd5..31fe18db02 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -775,6 +775,8 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict, zend_string **end, **ptr = strings - 1; ZEND_HASH_FOREACH_VAL(dictionary, cur) { + int i; + *++ptr = zval_get_string(cur); if (!*ptr || (*ptr)->len == 0) { if (*ptr) { @@ -787,6 +789,16 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict, php_error_docref(NULL, E_WARNING, "dictionary entries must be non-empty strings"); return 0; } + for (i = 0; i < (*ptr)->len; i++) { + if ((*ptr)->val[i] == 0) { + do { + efree(ptr); + } while (--ptr >= strings); + efree(strings); + php_error_docref(NULL, E_WARNING, "dictionary entries must not contain a NULL-byte"); + return 0; + } + } *dictlen += (*ptr)->len + 1; } ZEND_HASH_FOREACH_END(); @@ -950,7 +962,7 @@ PHP_FUNCTION(inflate_add) php_ctx->inflateDict = NULL; break; case Z_DATA_ERROR: - php_error_docref(NULL, E_WARNING, "dictionary does match expected dictionary (incorrect adler32 hash)"); + php_error_docref(NULL, E_WARNING, "dictionary does not match expected dictionary (incorrect adler32 hash)"); efree(php_ctx->inflateDict); zend_string_release(out); php_ctx->inflateDict = NULL;