summaryrefslogtreecommitdiffstats
path: root/Modules/binascii.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-10-19 04:47:13 (GMT)
committerGuido van Rossum <guido@python.org>1999-10-19 04:47:13 (GMT)
commiteba24bb920339038b473e8714690080009cb0d3a (patch)
treedd4c12c26f06020a692168c82ae27c789bef952c /Modules/binascii.c
parent88d23309e937df1cf99e9a649a7b2684fc1159c5 (diff)
downloadcpython-eba24bb920339038b473e8714690080009cb0d3a.zip
cpython-eba24bb920339038b473e8714690080009cb0d3a.tar.gz
cpython-eba24bb920339038b473e8714690080009cb0d3a.tar.bz2
Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call
_PyString_Resize() with a negative size.
Diffstat (limited to 'Modules/binascii.c')
-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;