From: Michael M Slusarz Date: Fri, 29 May 2009 02:53:22 +0000 (-0600) Subject: Fix off-by-one fgets() usage. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b9b3728fd7ef99e7f5ab8239072fa0038abbd7c0;p=horde.git Fix off-by-one fgets() usage. Pays to read the manual. fgets() reads 8192 - 1 bytes, so the index of the last byte is 8190, not 8191. --- diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php index 058d90552..d1155ca7a 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php @@ -3217,7 +3217,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base * will result in read errors. */ if ($tmp = fgets($this->_stream, 8192)) { $data .= $tmp; - if (!isset($tmp[8191]) || ($tmp[8191] == "\n")) { + if (!isset($tmp[8190]) || ($tmp[8190] == "\n")) { break; } }