From: Barry Warsaw Date: Mon, 12 Jul 1999 18:37:02 +0000 (+0000) Subject: AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch out X-Git-Tag: v1.6a1~1081 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=96e9bf45e8978e5f237460ac93e6f03c82cba06d;p=thirdparty%2FPython%2Fcpython.git AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch out for gotonext() pushing self.pos past the end of the string. This can happen if the message has a To field like "To: :" and you call msg.getaddrlist('to'). --- diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 662703beca3b..7030ee7cb315 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -553,10 +553,11 @@ class AddrlistClass: # address is a group returnlist = [] + fieldlen = len(self.field) self.pos = self.pos + 1 while self.pos < len(self.field): self.gotonext() - if self.field[self.pos] == ';': + if self.pos < fieldlen and self.field[self.pos] == ';': self.pos = self.pos + 1 break returnlist = returnlist + self.getaddress()