From b9b3728fd7ef99e7f5ab8239072fa0038abbd7c0 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 28 May 2009 20:53:22 -0600 Subject: [PATCH] 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. --- framework/Imap_Client/lib/Horde/Imap/Client/Socket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } } -- 2.11.0