From: Guido van Rossum Date: Tue, 19 Oct 1999 04:47:13 +0000 (+0000) Subject: Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call X-Git-Tag: v1.6a1~816 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eba24bb920339038b473e8714690080009cb0d3a;p=python Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call _PyString_Resize() with a negative size. --- diff --git a/Modules/binascii.c b/Modules/binascii.c index 73dc27a894..601169cfe3 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;