From 138f443974559615834490823e6cf5acba9f431f Mon Sep 17 00:00:00 2001 From: Anthony Baxter Date: Wed, 5 Dec 2001 06:11:26 +0000 Subject: [PATCH] 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. --- Lib/smtpd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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] -- 2.47.3