- prevent infinite loop on imap error in iil_C_HandlePartBody()

release-0.6
alecpl 16 years ago
parent 26d857447f
commit 4769ead5e8

@ -2336,7 +2336,7 @@ function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $mode=1, $file=NU
do { do {
$line = chop(iil_ReadLine($fp, 1000)); $line = chop(iil_ReadLine($fp, 1000));
$a = explode(' ', $line); $a = explode(' ', $line);
} while ($a[2] != 'FETCH'); } while (!($end = iil_StartsWith($line, $key, true)) && $a[2] != 'FETCH');
$len = strlen($line); $len = strlen($line);
// handle empty "* X FETCH ()" response // handle empty "* X FETCH ()" response
@ -2407,6 +2407,7 @@ function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $mode=1, $file=NU
} }
} }
// read in anything up until last line // read in anything up until last line
if (!$end)
do { do {
$line = iil_ReadLine($fp, 1024); $line = iil_ReadLine($fp, 1024);
} while (!iil_StartsWith($line, $key, true)); } while (!iil_StartsWith($line, $key, true));
@ -2425,12 +2426,10 @@ function iil_C_HandlePartBody(&$conn, $mailbox, $id, $part='', $mode=1, $file=NU
} }
return false; return false;
} else {
echo 'Select failed.';
} }
if ($mode==1) { if ($mode==1) {
if ($file) { if ($file && $result) {
fwrite($file, $result); fwrite($file, $result);
return true; return true;
} }

Loading…
Cancel
Save