diff options
author | Guido van Rossum <guido@python.org> | 1998-12-23 21:58:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-12-23 21:58:38 (GMT) |
commit | 99e11315360d700ca7abb251e3a6774de6f46be1 (patch) | |
tree | 5c2cddd476443c4b2cd696d5254ca71c24fdc3a0 /Lib | |
parent | 2d3b0d725ac255c9c9caad7db5ae00489922ccf9 (diff) | |
download | cpython-99e11315360d700ca7abb251e3a6774de6f46be1.zip cpython-99e11315360d700ca7abb251e3a6774de6f46be1.tar.gz cpython-99e11315360d700ca7abb251e3a6774de6f46be1.tar.bz2 |
Avoid crash in parsedate_tz() on certain invalid dates -- when the
field assumed to be the time is in fact the year, the resulting list
doesn't have enough items, and this isn't checked for. Return None
instead.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/rfc822.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 2e97ef4..b466fae 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -800,8 +800,10 @@ def parsedate_tz(data): if len(tm) == 2: [thh, tmm] = tm tss = '0' - else: + elif len(tm) == 3: [thh, tmm, tss] = tm + else: + return None try: yy = string.atoi(yy) dd = string.atoi(dd) |