mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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
1 changed files with 2 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue