summaryrefslogtreecommitdiff
path: root/ext/mbstring
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-11-05 22:24:47 +0100
committerAnatol Belski <ab@php.net>2015-11-05 22:24:47 +0100
commit2283551cfa8f6720d13ad396e8f3da1bc4f52389 (patch)
tree7b220e938b13b9402649b37a8076b2cbb816b3e0 /ext/mbstring
parentc1f893d894d00092aa839e236671a89948f5e431 (diff)
downloadphp-git-2283551cfa8f6720d13ad396e8f3da1bc4f52389.tar.gz
fix NULL deref in mbstring post handler
Diffstat (limited to 'ext/mbstring')
-rw-r--r--ext/mbstring/mb_gpc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index db6b5c47cd..0607894447 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -377,8 +377,10 @@ SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
php_stream_rewind(SG(request_info).request_body);
post_data_str = php_stream_copy_to_mem(SG(request_info).request_body, PHP_STREAM_COPY_ALL, 0);
- detected = _php_mb_encoding_handler_ex(&info, arg, ZSTR_VAL(post_data_str));
- zend_string_release(post_data_str);
+ detected = _php_mb_encoding_handler_ex(&info, arg, post_data_str ? ZSTR_VAL(post_data_str) : NULL);
+ if (post_data_str) {
+ zend_string_release(post_data_str);
+ }
MBSTRG(http_input_identify) = detected;
if (detected) {