com php-src: fix NULL deref in mbstring post handler: ext/mbstring/mb_gpc.c
| From: | Anatol Belski | Date: | Sun, 08 Nov 2015 03:24:40 +0000 |
| Subject: | com php-src: fix NULL deref in mbstring post handler: ext/mbstring/mb_gpc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89686@lists.php.net to get a copy of this message | ||
Commit: b6fc98b83318ad0cd414da74450da1ef381e12ca
Author: Anatol Belski <ab@php.net> Thu, 5 Nov 2015 22:24:47 +0100
Parents: 7554b10a77c123c191eacbf772559bd7329a08b3
Branches: PHP-7.0.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b6fc98b83318ad0cd414da74450da1ef381e12ca
Log:
fix NULL deref in mbstring post handler
Changed paths:
M ext/mbstring/mb_gpc.c
Diff:
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index db6b5c4..0607894 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) {