summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-09 18:10:47 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-09 18:10:47 (GMT)
commit3ebc45d602ce461e64121db98751837892b0c35f (patch)
treef825ca094db7e67b0853434093fcffc9544a1ffb /Modules
parent0999a1150af84a79bc09c3370e8290c032fbffce (diff)
downloadcpython-3ebc45d602ce461e64121db98751837892b0c35f.zip
cpython-3ebc45d602ce461e64121db98751837892b0c35f.tar.gz
cpython-3ebc45d602ce461e64121db98751837892b0c35f.tar.bz2
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr() instead of memchr().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/binascii.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 91309f6..00f950d 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -1150,7 +1150,7 @@ binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs)
/* XXX: this function has the side effect of converting all of
* the end of lines to be the same depending on this detection
* here */
- p = (unsigned char *) strchr((char *)data, '\n');
+ p = (unsigned char *) memchr(data, '\n', datalen);
if ((p != NULL) && (p > data) && (*(p-1) == '\r'))
crlf = 1;