summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/binascii.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 73dc27a..601169c 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -384,6 +384,8 @@ binascii_a2b_base64(self, args)
}
/* and remove any padding */
bin_len -= npad;
+ if (bin_len < 0)
+ bin_len = 0;
/* and set string size correctly */
_PyString_Resize(&rv, bin_len);
return rv;