Commit a475dcd9 authored by Barry Warsaw's avatar Barry Warsaw

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').
parent 0bd80d0b
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment