summaryrefslogtreecommitdiffstats
path: root/Modules/stropmodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
commit885d457709c1d680c899dc3d035a47c8fb514cfa (patch)
treed16b3a6f89208a1b46b786958a316ef9075d3fab /Modules/stropmodule.c
parent05bd787c6cd55f29d43465de621778221e0fc46e (diff)
downloadcpython-885d457709c1d680c899dc3d035a47c8fb514cfa.zip
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.gz
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.bz2
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
Diffstat (limited to 'Modules/stropmodule.c')
-rw-r--r--Modules/stropmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index bd56ee0..3c5de2b 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -772,7 +772,8 @@ strop_atoi(PyObject *self, PyObject *args)
end++;
if (*end != '\0') {
bad:
- sprintf(buffer, "invalid literal for atoi(): %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "invalid literal for atoi(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
@@ -865,12 +866,14 @@ strop_atof(PyObject *self, PyObject *args)
while (*end && isspace(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
- sprintf(buffer, "invalid literal for atof(): %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "invalid literal for atof(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
else if (errno != 0) {
- sprintf(buffer, "atof() literal too large: %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "atof() literal too large: %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}