[Python-checkins] r63734 - python/trunk/Python/mysnprintf.c

gregory.p.smith python-checkins at python.org
Tue May 27 00:09:13 CEST 2008


Author: gregory.p.smith
Date: Tue May 27 00:07:28 2008
New Revision: 63734

Log:
Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
passed in.  (The assert won't prevent this in non-debug builds).


Modified:
   python/trunk/Python/mysnprintf.c

Modified: python/trunk/Python/mysnprintf.c
==============================================================================
--- python/trunk/Python/mysnprintf.c	(original)
+++ python/trunk/Python/mysnprintf.c	Tue May 27 00:07:28 2008
@@ -98,7 +98,8 @@
 	PyMem_FREE(buffer);
 #endif
 Done:
-	str[size-1] = '\0';
+	if (size > 0)
+		str[size-1] = '\0';
 	return len;
 #undef _PyOS_vsnprintf_EXTRA_SPACE
 }


More information about the Python-checkins mailing list