[Python-checkins] r55205 - python/trunk/Modules/binascii.c

walter.doerwald python-checkins at python.org
Wed May 9 20:10:48 CEST 2007


Author: walter.doerwald
Date: Wed May  9 20:10:47 2007
New Revision: 55205

Modified:
   python/trunk/Modules/binascii.c
Log:
Backport checkin:
Fix a segfault when b"" was passed to b2a_qp() -- it was using strchr()
instead of memchr().


Modified: python/trunk/Modules/binascii.c
==============================================================================
--- python/trunk/Modules/binascii.c	(original)
+++ python/trunk/Modules/binascii.c	Wed May  9 20:10:47 2007
@@ -1150,7 +1150,7 @@
 	/* 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;
 


More information about the Python-checkins mailing list