mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
This commit is contained in:
parent
05bd787c6c
commit
885d457709
15 changed files with 61 additions and 42 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue