summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-07-12 18:37:02 (GMT)
committerBarry Warsaw <barry@python.org>1999-07-12 18:37:02 (GMT)
commit96e9bf45e8978e5f237460ac93e6f03c82cba06d (patch)
tree327a7b7560ca04c0edc4ce791d6c5d8866f00d90 /Lib
parent860e25614786c9c89a0ba4fe097f1e1e09e9cf57 (diff)
downloadcpython-96e9bf45e8978e5f237460ac93e6f03c82cba06d.zip
cpython-96e9bf45e8978e5f237460ac93e6f03c82cba06d.tar.gz
cpython-96e9bf45e8978e5f237460ac93e6f03c82cba06d.tar.bz2
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').
Diffstat (limited to 'Lib')
-rw-r--r--Lib/rfc822.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index 662703b..7030ee7 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()