summaryrefslogtreecommitdiffstats
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-12-09 15:15:31 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-12-09 15:15:31 (GMT)
commit93321f333c7fe4a55bdedc9511667916f8bd2ed5 (patch)
tree81ab146556158c027d16da4a579ad6a1a49b825a /Lib/imaplib.py
parent29dcdabf40f7642c96169ede9040d50a10926832 (diff)
downloadcpython-93321f333c7fe4a55bdedc9511667916f8bd2ed5.zip
cpython-93321f333c7fe4a55bdedc9511667916f8bd2ed5.tar.gz
cpython-93321f333c7fe4a55bdedc9511667916f8bd2ed5.tar.bz2
Issue 5949: fixed IMAP4_SSL hang when the IMAP server response is
missing proper end-of-line termination. Patch and tests by Scott Dial. The new tests include a test harness which will make it easier to add additional tests.
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r--Lib/imaplib.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index f13350e..5a45845 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -1001,6 +1001,8 @@ class IMAP4:
raise self.abort('socket error: EOF')
# Protocol mandates all lines terminated by CRLF
+ if not line.endswith('\r\n'):
+ raise self.abort('socket error: unterminated line')
line = line[:-2]
if __debug__:
@@ -1167,7 +1169,7 @@ else:
while 1:
char = self.sslobj.read(1)
line.append(char)
- if char == "\n": return ''.join(line)
+ if char in ("\n", ""): return ''.join(line)
def send(self, data):