From 9c093ecf9121449c903f091697b7ab65f8d2e4b0 Mon Sep 17 00:00:00 2001 From: stekkel Date: Wed, 4 Oct 2006 19:25:25 +0000 Subject: [PATCH] Fix for bug #1562271 * OK [PARSE] Unexpected characters at end of address: {SET:debug=51} Triggered literal fetching from the imap stream whil {SET:debug=51} is not an integer and not meant as literal. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11831 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_general.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/functions/imap_general.php b/functions/imap_general.php index 8d6d27ee..5a025a88 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -516,14 +516,21 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors, if ($s === "}\r\n") { $j = strrpos($read,'{'); $iLit = substr($read,$j+1,-3); - $data[] = $read; - $sLiteral = fread($imap_stream,$iLit); - if ($sLiteral === false) { /* error */ - $read = false; - break 3; /* while switch while */ + // check for numeric value to avoid that untagged responses like: + // * OK [PARSE] Unexpected characters at end of address: {SET:debug=51} + // will trigger literal fetching ({SET:debug=51} !== int ) + if (is_numeric($iLit)) { + $data[] = $read; + $sLiteral = fread($imap_stream,$iLit); + if ($sLiteral === false) { /* error */ + $read = false; + break 3; /* while switch while */ + } + $data[] = $sLiteral; + $data[] = sqimap_fgets($imap_stream); + } else { + $data[] = $read; } - $data[] = $sLiteral; - $data[] = sqimap_fgets($imap_stream); } else { $data[] = $read; } @@ -743,9 +750,9 @@ function sqimap_create_stream($server,$port,$tls=0) { * Logs the user into the IMAP server. If $hide is set, no error messages * will be displayed. This function returns the IMAP connection handle. * @param string $username user name - * @param string $password password encrypted with onetimepad. Since 1.5.2 - * function can use internal password functions, if parameter is set to - * boolean false. + * @param string $password password encrypted with onetimepad. Since 1.5.2 + * function can use internal password functions, if parameter is set to + * boolean false. * @param string $imap_server_address address of imap server * @param integer $imap_port port of imap server * @param boolean $hide controls display connection errors -- 2.25.1