Prevent loop in parseAddress: if the address is invalid and looks like:
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 25 May 2003 18:58:15 +0000 (18:58 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 25 May 2003 18:58:15 +0000 (18:58 +0000)
Thijs <aap
(no closing ">"), 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

index 8d58c48bc49d4da6d8fbd409b21196db2b683b83..a3d67722e602031e8858f3e149a2d5b3b9f80d12 100755 (executable)
@@ -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;