diff options
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r-- | Lib/imaplib.py | 4 |
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): |