diff options
author | Georg Brandl <georg@python.org> | 2013-10-27 05:52:14 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2013-10-27 05:52:14 (GMT) |
commit | ca580f4ec1b08f492cbc8673e316f5cadf47aec2 (patch) | |
tree | f008e13828169e119f8a940c3678d793c3bd11cf /Lib/test/test_imaplib.py | |
parent | 246eb1105842c746a80865cd492502ad413949c2 (diff) | |
download | cpython-ca580f4ec1b08f492cbc8673e316f5cadf47aec2.zip cpython-ca580f4ec1b08f492cbc8673e316f5cadf47aec2.tar.gz cpython-ca580f4ec1b08f492cbc8673e316f5cadf47aec2.tar.bz2 |
Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit
line length. Patch by Emil Lind.
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r-- | Lib/test/test_imaplib.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 7db3f7d..daa8afe 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -325,6 +325,17 @@ class BaseThreadedNetworkedTests(unittest.TestCase): self.assertEqual(ret, "OK") + def test_linetoolong(self): + class TooLongHandler(SimpleIMAPHandler): + def handle(self): + # Send a very long response line + self.wfile.write(b'* OK ' + imaplib._MAXLINE*b'x' + b'\r\n') + + with self.reaped_server(TooLongHandler) as server: + self.assertRaises(imaplib.IMAP4.error, + self.imap_class, *server.server_address) + + class ThreadedNetworkedTests(BaseThreadedNetworkedTests): server_class = socketserver.TCPServer |