endless loop fix
[squirrelmail.git] / class / mime / Message.class.php
index b3fb64c20bacf406ea1837c8f6138450ff684b3a..0cec7e2432f7979f06a24c9cae2bbb706a1ae1c5 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * Message.class.php
  *
- * Copyright (c) 2002 The SquirrelMail Project Team
+ * Copyright (c) 2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions needed to handle mime messages.
@@ -375,9 +375,8 @@ class Message {
     function parseEnvelope($read, &$i, $hdr) {
         $arg_no = 0;
         $arg_a = array();
-
+        ++$i;
         for ($cnt = strlen($read); ($i < $cnt) && ($read{$i} != ')'); ++$i) {
-            ++$i;
             $char = strtoupper($read{$i});
             switch ($char) {
                 case '"':
@@ -386,6 +385,9 @@ class Message {
                     break;
                 case '{':
                     $arg_a[] = $this->parseLiteral($read, $i);
+                   /* temp bugfix (SM 1.5 will have a working clean version)
+                      too much work to implement that version right now */
+//                 --$i;
                     ++$arg_no;
                     break;
                 case 'N':
@@ -463,6 +465,9 @@ class Message {
           /* Now read the literal */
           $s = ($lit_cnt ? substr($read,$i,$lit_cnt): '');
           $i += $lit_cnt;
+          /* temp bugfix (SM 1.5 will have a working clean version)
+             too much work to implement that version right now */
+          --$i;
        } else { /* should never happen */
           $i += 3; /* } + \r + \n */
           $s = '';
@@ -475,7 +480,7 @@ class Message {
        $iPos = ++$i;
        while (true) {
           $iPos = strpos($read,'"',$iPos);
-          if ($iPos === false) break;
+          if (!$iPos) break;
           if ($iPos && $read{$iPos -1} != '\\') {
              $s = substr($read,$i,($iPos-$i));
              $i = $iPos;