From: Michael Wallner Date: Mon, 12 Jan 2009 10:03:16 +0000 (+0000) Subject: fix Bug #15497 HttpInflateStream::finish segfaults when passing NULL X-Git-Tag: RELEASE_1_7_0b1~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=09e6d980d8f2a33bbdb21e174557f8a5718a7340;p=m6w6%2Fext-http fix Bug #15497 HttpInflateStream::finish segfaults when passing NULL --- diff --git a/http_deflatestream_object.c b/http_deflatestream_object.c index 01e8ae2..ad3bfb7 100644 --- a/http_deflatestream_object.c +++ b/http_deflatestream_object.c @@ -242,8 +242,10 @@ PHP_METHOD(HttpDeflateStream, flush) STR_FREE(encoded); updated_len += encoded_len; RETURN_STRINGL(updated, updated_len, 0); - } else { + } else if (encoded) { RETVAL_STRINGL(encoded, encoded_len, 0); + } else { + RETVAL_NULL(); } } else { RETVAL_FALSE; diff --git a/http_inflatestream_object.c b/http_inflatestream_object.c index acd1257..6872943 100644 --- a/http_inflatestream_object.c +++ b/http_inflatestream_object.c @@ -263,9 +263,11 @@ PHP_METHOD(HttpInflateStream, finish) STR_FREE(decoded); updated_len += decoded_len; RETVAL_STRINGL(updated, updated_len, 0); - } else { + } else if (decoded) { STR_FREE(updated); RETVAL_STRINGL(decoded, decoded_len, 0); + } else { + RETVAL_NULL(); } } else { STR_FREE(updated);