summaryrefslogtreecommitdiff
path: root/Modules/binascii.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-09 18:13:53 +0000
committerWalter Dörwald <walter@livinglogic.de>2007-05-09 18:13:53 +0000
commit0ac60611febb8b73635ea547068843657ee9c491 (patch)
tree0ac61184cc9d5955873b84ddc5f7faac34fa7fa1 /Modules/binascii.c
parent6ca6f1472c8d9343f4f0fc8e45fc894c801ae4ca (diff)
downloadcpython-git-0ac60611febb8b73635ea547068843657ee9c491.tar.gz
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr() instead of memchr().
Diffstat (limited to 'Modules/binascii.c')
-rw-r--r--Modules/binascii.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 91309f673b..00f950d19d 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;