From: Ilia Alshanetsky Date: Mon, 16 Jun 2003 17:42:04 +0000 (+0000) Subject: MFH: Fixed bug #24150 (crash in imap_fetch_overview() & X-Git-Tag: php-4.3.3RC1~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=015712b9f1830851674b447fc706cecf55192a02;p=php MFH: Fixed bug #24150 (crash in imap_fetch_overview() & imap_rfc822_write_address()) --- diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 069c69557c..0ad60d0a26 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1955,6 +1955,10 @@ PHP_FUNCTION(imap_rfc822_write_address) addr->error=NIL; addr->adl=NIL; + if (_php_imap_address_size(addr) >= MAILTMPLEN) { + RETURN_FALSE; + } + string[0]='\0'; rfc822_write_address(string, addr); RETVAL_STRING(string, 1); @@ -2715,13 +2719,13 @@ PHP_FUNCTION(imap_fetch_overview) if (env->subject) { add_property_string(myoverview, "subject", env->subject, 1); } - if (env->from) { + if (env->from && _php_imap_address_size(env->from) >= MAILTMPLEN) { env->from->next=NULL; address[0] = '\0'; rfc822_write_address(address, env->from); add_property_string(myoverview, "from", address, 1); } - if (env->to) { + if (env->to && _php_imap_address_size(env->from) >= MAILTMPLEN) { env->to->next = NULL; address[0] = '\0'; rfc822_write_address(address, env->to);