diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-01-05 14:15:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-05 14:15:50 +0200 |
commit | b19c0d77e6f25ea831ab608c71f15d0d9266c8c4 (patch) | |
tree | 42f6ede3be2365c767fd15a0faf4baa3f9a82f11 /Lib/base64.py | |
parent | bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618) (diff) | |
download | cpython-b19c0d77e6f25ea831ab608c71f15d0d9266c8c4.tar.gz cpython-b19c0d77e6f25ea831ab608c71f15d0d9266c8c4.tar.bz2 cpython-b19c0d77e6f25ea831ab608c71f15d0d9266c8c4.zip |
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. (GH-17616)
Diffstat (limited to 'Lib/base64.py')
-rwxr-xr-x | Lib/base64.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/base64.py b/Lib/base64.py index 2be9c395a96..2e70223dfe7 100755 --- a/Lib/base64.py +++ b/Lib/base64.py @@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False): altchars = _bytes_from_decode_data(altchars) assert len(altchars) == 2, repr(altchars) s = s.translate(bytes.maketrans(altchars, b'+/')) - if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s): + if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s): raise binascii.Error('Non-base64 digit found') return binascii.a2b_base64(s) |