mirror of https://github.com/python/cpython
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').
This commit is contained in:
parent
860e256147
commit
96e9bf45e8
|
@ -553,10 +553,11 @@ class AddrlistClass:
|
||||||
# address is a group
|
# address is a group
|
||||||
returnlist = []
|
returnlist = []
|
||||||
|
|
||||||
|
fieldlen = len(self.field)
|
||||||
self.pos = self.pos + 1
|
self.pos = self.pos + 1
|
||||||
while self.pos < len(self.field):
|
while self.pos < len(self.field):
|
||||||
self.gotonext()
|
self.gotonext()
|
||||||
if self.field[self.pos] == ';':
|
if self.pos < fieldlen and self.field[self.pos] == ';':
|
||||||
self.pos = self.pos + 1
|
self.pos = self.pos + 1
|
||||||
break
|
break
|
||||||
returnlist = returnlist + self.getaddress()
|
returnlist = returnlist + self.getaddress()
|
||||||
|
|
Loading…
Reference in New Issue