summaryrefslogtreecommitdiffstats
path: root/Modules/binascii.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/binascii.c')
-rw-r--r--Modules/binascii.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 250f03a..6bb01d1 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -414,6 +414,13 @@ binascii_a2b_base64_impl(PyObject *module, Py_buffer *data, int strict_mode)
if (this_ch == BASE64_PAD) {
padding_started = 1;
+ if (strict_mode && quad_pos == 0) {
+ state = get_binascii_state(module);
+ if (state) {
+ PyErr_SetString(state->Error, "Excess padding not allowed");
+ }
+ goto error_end;
+ }
if (quad_pos >= 2 && quad_pos + ++pads >= 4) {
/* A pad sequence means we should not parse more input.
** We've already interpreted the data from the quad at this point.