From: Anthony Baxter Date: Wed, 5 Dec 2001 06:11:26 +0000 (+0000) Subject: backport half of 1.11: X-Git-Tag: v2.1.2c1~62 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=138f443974559615834490823e6cf5acba9f431f;p=thirdparty%2FPython%2Fcpython.git backport half of 1.11: __getaddr(): Watch out for empty addresses that can happen when something like "MAIL FROM:" is received. This avoids the IndexError and rightly returns an SMTP syntax error. --- diff --git a/Lib/smtpd.py b/Lib/smtpd.py index fffc2295194e..95bacaec4ee9 100755 --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -206,7 +206,9 @@ class SMTPChannel(asynchat.async_chat): keylen = len(keyword) if arg[:keylen].upper() == keyword: address = arg[keylen:].strip() - if address[0] == '<' and address[-1] == '>' and address != '<>': + if not address: + pass + elif address[0] == '<' and address[-1] == '>' and address != '<>': # Addresses can be in the form but watch out # for null address, e.g. <> address = address[1:-1]