diff options
author | Abhilash Raj <maxking@users.noreply.github.com> | 2019-12-09 01:37:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-09 01:37:34 (GMT) |
commit | 3ae4ea1931361dd2743e464790e739d9285501bf (patch) | |
tree | 56b73bd2a05fc6f53d9cbb0ad9cfb72547b97111 /Lib/email | |
parent | 68157da8b42b26408af5d157d2dba4fcf29c6320 (diff) | |
download | cpython-3ae4ea1931361dd2743e464790e739d9285501bf.zip cpython-3ae4ea1931361dd2743e464790e739d9285501bf.tar.gz cpython-3ae4ea1931361dd2743e464790e739d9285501bf.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.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/_header_value_parser.py | 2 |
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] != '<': |