Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call

_PyString_Resize() with a negative size.
This commit is contained in:
Guido van Rossum 1999-10-19 04:47:13 +00:00
parent 88d23309e9
commit eba24bb920
1 changed files with 2 additions and 0 deletions

View File

@ -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;