]> granicus.if.org Git - python/commitdiff
Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call
authorGuido van Rossum <guido@python.org>
Tue, 19 Oct 1999 04:47:13 +0000 (04:47 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 19 Oct 1999 04:47:13 +0000 (04:47 +0000)
_PyString_Resize() with a negative size.

Modules/binascii.c

index 73dc27a8944d30e95a2f85c33efd94157bd96136..601169cfe3e5a9bc9eb6919718fef5fd09934a40 100644 (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;