summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2015-05-15 02:42:11 +0200
committerBob Weinand <bobwei9@hotmail.com>2015-05-15 02:42:11 +0200
commit00ea48ad43122c67c904965d4c315237740685ea (patch)
tree12438f9460ac01a0f1429eaf6d2cc327277fb49b
parent227a21b297c73f09e15e72a80c21254554d49d66 (diff)
downloadphp-git-00ea48ad43122c67c904965d4c315237740685ea.tar.gz
Minor typo in warning message
-rw-r--r--ext/zlib/tests/dictionary_usage.phpt2
-rw-r--r--ext/zlib/zlib.c14
2 files changed, 14 insertions, 2 deletions
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;