summaryrefslogtreecommitdiff
path: root/Lib/email/header.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/header.py')
-rw-r--r--Lib/email/header.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py
index 6e03922aa0..9e91dc2077 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -92,6 +92,9 @@ def decode_header(header):
if encoding == 'q':
dec = email.quoprimime.header_decode(encoded)
elif encoding == 'b':
+ paderr = len(encoded) % 4 # Postel's law: add missing padding
+ if paderr:
+ encoded += '==='[:4 - paderr]
try:
dec = email.base64mime.decode(encoded)
except binascii.Error: