summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-12-09 02:12:50 (GMT)
committerGitHub <noreply@github.com>2019-12-09 02:12:50 (GMT)
commit2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3 (patch)
treefa0a5235b5e76c5548cc961b70dab10adda146ea /Lib/email
parentf66f4a09d0b6817fe6a86a567fd506aa223f1563 (diff)
downloadcpython-2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3.zip
cpython-2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3.tar.gz
cpython-2abd3a8f580e6c7b1ce88b2ae9f9a783f4aea5d3.tar.bz2
bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504)
Fix a potential IndexError when passing an empty value to the message-id parser. Instead, HeaderParseError should be raised. (cherry picked from commit 3ae4ea1931361dd2743e464790e739d9285501bf) Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/_header_value_parser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index cb01322..9c55ef7 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -2047,7 +2047,7 @@ def get_msg_id(value):
no-fold-literal = "[" *dtext "]"
"""
msg_id = MsgID()
- if value[0] in CFWS_LEADER:
+ if value and value[0] in CFWS_LEADER:
token, value = get_cfws(value)
msg_id.append(token)
if not value or value[0] != '<':