diff Modules/arraymodule.c @ 21073:304b34023876 legacy-trunk

sprintf -> PyOS_snprintf in some "obviously safe" cases. Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
author Tim Peters <tim.peters@gmail.com>
date Wed, 28 Nov 2001 20:27:42 +0000
parents ef2031c54875
children 91dd223829c6
line wrap: on
line diff
--- a/Modules/arraymodule.c	Wed Nov 28 20:24:33 2001 +0000
+++ b/Modules/arraymodule.c	Wed Nov 28 20:27:42 2001 +0000
@@ -1313,12 +1313,13 @@
 	int i, len;
 	len = a->ob_size;
 	if (len == 0) {
-		sprintf(buf, "array('%c')", a->ob_descr->typecode);
+		PyOS_snprintf(buf, sizeof(buf), "array('%c')",
+			      a->ob_descr->typecode);
 		return PyString_FromString(buf);
 	}
 	if (a->ob_descr->typecode == 'c') {
 		PyObject *t_empty = PyTuple_New(0);
-		sprintf(buf, "array('c', ");
+		PyOS_snprintf(buf, sizeof(buf), "array('c', ");
 		s = PyString_FromString(buf);
 		v = array_tostring(a, t_empty);
 		Py_DECREF(t_empty);
@@ -1328,7 +1329,7 @@
 		PyString_ConcatAndDel(&s, PyString_FromString(")"));
 		return s;
 	}
-	sprintf(buf, "array('%c', [", a->ob_descr->typecode);
+	PyOS_snprintf(buf, sizeof(buf), "array('%c', [", a->ob_descr->typecode);
 	s = PyString_FromString(buf);
 	comma = PyString_FromString(", ");
 	for (i = 0; i < len && !PyErr_Occurred(); i++) {