]> granicus.if.org Git - php/commitdiff
fix NULL deref in mbstring post handler
authorAnatol Belski <ab@php.net>
Thu, 5 Nov 2015 21:24:47 +0000 (22:24 +0100)
committerAnatol Belski <ab@php.net>
Thu, 5 Nov 2015 21:24:47 +0000 (22:24 +0100)
ext/mbstring/mb_gpc.c

index db6b5c47cdb4322f94f79ccc16e4a70203b0da2a..0607894447fa60c7affd2f8188a24f5a5aa57b7b 100644 (file)
@@ -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) {