From: Michael Wallner Date: Wed, 13 Jul 2016 08:05:39 +0000 (+0200) Subject: fix #47 X-Git-Tag: RELEASE_2_6_0_BETA1~9 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a1185e34f27a1da2caa3479cab14383b96b53c39;p=m6w6%2Fext-http fix #47 --- diff --git a/src/php_http_params.c b/src/php_http_params.c index c722f06..c0071ac 100644 --- a/src/php_http_params.c +++ b/src/php_http_params.c @@ -522,6 +522,10 @@ static void merge_param(HashTable *params, zval *zdata, zval ***current_param, z static void push_param(HashTable *params, php_http_params_state_t *state, const php_http_params_opts_t *opts TSRMLS_DC) { + if (!state->current.val) { + return; + } + if (state->val.str) { if (0 < (state->val.len = state->input.str - state->val.str)) { sanitize_value(opts->flags, state->val.str, state->val.len, *(state->current.val), state->rfc5987 TSRMLS_CC); diff --git a/tests/gh-issue47.phpt b/tests/gh-issue47.phpt new file mode 100644 index 0000000..6956588 --- /dev/null +++ b/tests/gh-issue47.phpt @@ -0,0 +1,27 @@ +--TEST-- +Null pointer deref in sanitize_value +--SKIPIF-- + +--FILE-- +mod($urls[1]); + +echo $url1; + +?> + +===DONE=== +--EXPECTF-- +Test +http://%s/ +===DONE===