cpython: 8a6def3add5b (original) (raw)

Mercurial > cpython

changeset 85714:8a6def3add5b 2.6

#16042: CVE-2013-1752: Limit amount of data read by limiting the call to readline(). The SSLFakeFile.readline() method needs to support limiting readline() as well. It's not a full emulation of readline()'s signature, but this class is only used by smtplib's code, so it doesn't have to be. Modified version of original patch by Christian Heimes. [#16042]

Andrew Kuchling amk@amk.ca
date Sun, 15 Sep 2013 13:11:47 -0400
parents 07ee48ce4513
children a9f147749b68 e5c4eb6b8e05
files Lib/smtplib.py Lib/test/test_smtplib.py Misc/NEWS
diffstat 3 files changed, 42 insertions(+), 5 deletions(-)[+] [-] Lib/smtplib.py 13 Lib/test/test_smtplib.py 29 Misc/NEWS 5

line wrap: on

line diff

--- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -57,6 +57,7 @@ from sys import stderr SMTP_PORT = 25 SMTP_SSL_PORT = 465 CRLF="\r\n" +_MAXLINE = 8192 # more than 8 times larger than RFC 821, 4.5.3 OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I) @@ -170,10 +171,14 @@ else: def init(self, sslobj): self.sslobj = sslobj

@@ -334,11 +339,13 @@ class SMTP: if self.file is None: self.file = self.sock.makefile('rb') while 1:

--- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -273,6 +273,32 @@ class BadHELOServerTests(TestCase): HOST, self.port, 'localhost', 3) +class TooLongLineTests(TestCase):

+

+

+

+

+ + sim_users = {'Mr.A@somewhere.com':'John A', 'Ms.B@somewhere.com':'Sally B', 'Mrs.C@somewhereesle.com':'Ruth C', @@ -482,7 +508,8 @@ class SMTPSimTests(TestCase): def test_main(verbose=None): test_support.run_unittest(GeneralTests, DebuggingServerTests, NonConnectingTests,

if name == 'main': test_main()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,13 +16,16 @@ Library