diff options
author | Andi Gutmans <andi@php.net> | 2001-04-30 10:23:13 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2001-04-30 10:23:13 +0000 |
commit | 1d3ef307143843fcf966f260af5bf29aaedc2bfd (patch) | |
tree | a17ee40912545f5097ccbcbf6a0edc599a6b4b9d /ext/imap/php_imap.c | |
parent | 266a3b0dd6baa44c41ba00e96944ece92f999064 (diff) | |
download | php-git-1d3ef307143843fcf966f260af5bf29aaedc2bfd.tar.gz |
- Fix crash bugs when rfc822_qprint and rfc822_base64 return NULL
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r-- | ext/imap/php_imap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 7fb8213b15..1d8ff0714d 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2116,6 +2116,9 @@ PHP_FUNCTION(imap_base64) convert_to_string_ex(text); decode = (char *) rfc822_base64((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength); + if (decode == NULL) { + RETURN_FALSE; + } RETVAL_STRINGL(decode, newlength, 1); fs_give((void**) &decode); } @@ -2137,6 +2140,9 @@ PHP_FUNCTION(imap_qprint) convert_to_string_ex(text); decode = (char *) rfc822_qprint((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength); + if (decode == NULL) { + RETURN_FALSE; + } RETVAL_STRINGL(decode, newlength, 1); fs_give((void**) &decode); } @@ -3715,6 +3721,11 @@ PHP_FUNCTION(imap_mime_header_decode) } else if (encoding == 'b' || encoding == 'B') { decode = (char *)rfc822_base64((unsigned char *) text, strlen(text), &newlength); /* Decode 'B' encoded data */ } + if (decode == NULL) { + efree(charset); + zval_dtor(return_value); + RETURN_FALSE; + } MAKE_STD_ZVAL(myobject); object_init(myobject); add_property_string(myobject, "charset", charset, 1); |