summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.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/_testcapimodule.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/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 01e103b..0f5fa7c 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -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;