summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poplib.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-10-27 06:23:53 (GMT)
committerGeorg Brandl <georg@python.org>2013-10-27 06:23:53 (GMT)
commit7e27abbb3936e9a7baea13ceeac6abd256bc0d6f (patch)
tree6ee857cd02820aa984dddf6d9b8c5fc21cb9ffbe /Lib/test/test_poplib.py
parent72c98d3a761457a4f2b8054458b19f051dfb5886 (diff)
downloadcpython-7e27abbb3936e9a7baea13ceeac6abd256bc0d6f.zip
cpython-7e27abbb3936e9a7baea13ceeac6abd256bc0d6f.tar.gz
cpython-7e27abbb3936e9a7baea13ceeac6abd256bc0d6f.tar.bz2
Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to
prevent readline() calls from consuming too much memory. Patch by Jyrki Pulliainen.
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r--Lib/test/test_poplib.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index c0929a0..28e6a6b 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -83,7 +83,7 @@ class DummyPOP3Handler(asynchat.async_chat):
def cmd_list(self, arg):
if arg:
- self.push('+OK %s %s' %(arg, arg))
+ self.push('+OK %s %s' % (arg, arg))
else:
self.push('+OK')
asynchat.async_chat.push(self, LIST_RESP)
@@ -208,6 +208,10 @@ class TestPOP3Class(TestCase):
foo = self.client.retr('foo')
self.assertEqual(foo, expected)
+ def test_too_long_lines(self):
+ self.assertRaises(poplib.error_proto, self.client._shortcmd,
+ 'echo +%s' % ((poplib._MAXLINE + 10) * 'a'))
+
def test_dele(self):
self.assertOK(self.client.dele('foo'))