From 04bfe52bb1d103e0770a6ed141b656b78a0ea483 Mon Sep 17 00:00:00 2001 From: kink Date: Sun, 25 May 2003 18:58:15 +0000 Subject: [PATCH] Prevent loop in parseAddress: if the address is invalid and looks like: Thijs "), parseAddress would enter an infinite loop. This is solved by increasing $pos when no closing > is found. Closes 742584, thanks Jeroen van Wolffelaar. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4939 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index 8d58c48b..a3d67722 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -486,8 +486,13 @@ function parseAddress($address, $max=0, $addr_ar = array(), $group = '', $host=' case '<': /* get email address */ $addr_start = $pos; $addr_end = strpos($address,'>',$addr_start); - $addr = substr($address,$addr_start+1,$addr_end-$addr_start-1); - $pos = $addr_end+1; + if($addr_end === FALSE) { + // in case the address doesn't end, prevent loop + $pos++; + } else { + $addr = substr($address,$addr_start+1,$addr_end-$addr_start-1); + $pos = $addr_end+1; + } break; case '(': /* rip off comments */ $addr_start = $pos; -- 2.25.1