From 0925e419dfc5de666965dcd15ae08d045c7df36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Wed, 9 May 2007 18:23:50 +0000 Subject: Forwardport checkin: Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr() instead of memchr(). --- Modules/binascii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v0.12