Procházet zdrojové kódy

Prevent loop in parseAddress: if the address is invalid and looks like:
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.

Thijs Kinkhorst před 22 roky
rodič
revize
5136084e4e
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      functions/imap_general.php

+ 7 - 2
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;