Commit af8aef9e authored by Barry Warsaw's avatar Barry Warsaw

PyFloat_FromString(): Conversion of sprintf() to PyOS_snprintf() for

buffer overrun avoidance.
parent 01d697a0
......@@ -150,7 +150,8 @@ PyFloat_FromString(PyObject *v, char **pend)
if (end > last)
end = last;
if (end == s) {
sprintf(buffer, "invalid literal for float(): %.200s", s);
PyOS_snprintf(buffer, sizeof(buffer),
"invalid literal for float(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
......@@ -159,7 +160,8 @@ PyFloat_FromString(PyObject *v, char **pend)
while (*end && isspace(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
sprintf(buffer, "invalid literal for float(): %.200s", s);
PyOS_snprintf(buffer, sizeof(buffer),
"invalid literal for float(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment