]> granicus.if.org Git - python/commitdiff
ste_repr(): Conversion of sprintf() to PyOS_snprintf() for buffer
authorBarry Warsaw <barry@python.org>
Wed, 28 Nov 2001 21:36:28 +0000 (21:36 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 28 Nov 2001 21:36:28 +0000 (21:36 +0000)
overrun avoidance.

Python/symtable.c

index 4f63ae798f02d82c825cf39026642338e10251e7..080bfd5aa335bdd170c530392d454b3820000cee 100644 (file)
@@ -85,10 +85,11 @@ ste_repr(PySymtableEntryObject *ste)
 {
        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);
 }