mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -19,7 +19,7 @@ raiseTestError(const char* test_name, const char* msg)
|
|||
if (strlen(test_name) + strlen(msg) > sizeof(buf) - 50)
|
||||
PyErr_SetString(TestError, "internal error msg too large");
|
||||
else {
|
||||
sprintf(buf, "%s: %s", test_name, msg);
|
||||
PyOS_snprintf(buf, sizeof(buf), "%s: %s", test_name, msg);
|
||||
PyErr_SetString(TestError, buf);
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -36,7 +36,8 @@ sizeof_error(const char* fatname, const char* typename,
|
|||
int expected, int got)
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "%.200s #define == %d but sizeof(%.200s) == %d",
|
||||
PyOS_snprintf(buf, sizeof(buf),
|
||||
"%.200s #define == %d but sizeof(%.200s) == %d",
|
||||
fatname, expected, typename, got);
|
||||
PyErr_SetString(TestError, buf);
|
||||
return (PyObject*)NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue