cvs: php4 /ext/imap php_imap.c
| From: | Andi Gutmans | Date: | Mon, 30 Apr 2001 10:23:13 +0000 |
| Subject: | cvs: php4 /ext/imap php_imap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5378@lists.php.net to get a copy of this message | ||
andi Mon Apr 30 03:23:13 2001 EDT
Modified files:
/php4/ext/imap php_imap.c
Log:
- Fix crash bugs when rfc822_qprint and rfc822_base64 return NULL
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.65 php4/ext/imap/php_imap.c:1.66
--- php4/ext/imap/php_imap.c:1.65 Mon Apr 23 14:58:44 2001
+++ php4/ext/imap/php_imap.c Mon Apr 30 03:23:13 2001
@@ -25,7 +25,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.65 2001/04/23 21:58:44 chagenbu Exp $ */
+/* $Id: php_imap.c,v 1.66 2001/04/30 10:23:13 andi Exp $ */
#define IMAP41
@@ -2116,6 +2116,9 @@
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 @@
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);
}
@@ -3714,6 +3720,11 @@
decode = (char *)rfc822_qprint((unsigned char *) text, strlen(text), &newlength);
} 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);