diff Python/symtable.c @ 21090:5e25c669741c legacy-trunk

ste_repr(): Conversion of sprintf() to PyOS_snprintf() for buffer overrun avoidance.
author Barry Warsaw <barry@python.org>
date Wed, 28 Nov 2001 21:36:28 +0000
parents 3faabf54b8b8
children 485422900ef0
line wrap: on
line diff
--- a/Python/symtable.c	Wed Nov 28 21:35:49 2001 +0000
+++ b/Python/symtable.c	Wed Nov 28 21:36:28 2001 +0000
@@ -85,10 +85,11 @@
 {
 	char buf[256];
 
-	sprintf(buf, "<symtable entry %.100s(%ld), line %d>",
-		PyString_AS_STRING(ste->ste_name),
-		PyInt_AS_LONG(ste->ste_id),
-		ste->ste_lineno);
+	PyOS_snprintf(buf, sizeof(buf),
+		      "<symtable entry %.100s(%ld), line %d>",
+		      PyString_AS_STRING(ste->ste_name),
+		      PyInt_AS_LONG(ste->ste_id),
+		      ste->ste_lineno);
 	return PyString_FromString(buf);
 }