summaryrefslogtreecommitdiff
path: root/Lib/email
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-12-08 17:37:34 -0800
committerGitHub <noreply@github.com>2019-12-08 17:37:34 -0800
commit3ae4ea1931361dd2743e464790e739d9285501bf (patch)
tree56b73bd2a05fc6f53d9cbb0ad9cfb72547b97111 /Lib/email
parent68157da8b42b26408af5d157d2dba4fcf29c6320 (diff)
downloadcpython-git-3ae4ea1931361dd2743e464790e739d9285501bf.tar.gz
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.
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 cb013225ec..9c55ef7fb4 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] != '<':