summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-28 22:07:30 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-28 22:07:30 (GMT)
commit75cdad558472781162a83439f3e6edb61d4d40e6 (patch)
treed4c4d78f70a7e37860209ac8a2b9019d24b997cc /Modules
parent179c48c60e2476643863313ee0e0aa01bf338ad9 (diff)
downloadcpython-75cdad558472781162a83439f3e6edb61d4d40e6.zip
cpython-75cdad558472781162a83439f3e6edb61d4d40e6.tar.gz
cpython-75cdad558472781162a83439f3e6edb61d4d40e6.tar.bz2
More sprintf -> PyOS_snprintf.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/almodule.c3
-rw-r--r--Modules/posixmodule.c6
-rw-r--r--Modules/socketmodule.c3
-rw-r--r--Modules/stropmodule.c6
4 files changed, 11 insertions, 7 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c
index 9e26081..e9b2114 100644
--- a/Modules/almodule.c
+++ b/Modules/almodule.c
@@ -1519,7 +1519,8 @@ al_GetParams(PyObject *self, PyObject *args)
for (i = 0; i < npvs; i++) {
if (pvs[i].sizeOut < 0) {
char buf[32];
- sprintf(buf, "problem with param %d", i);
+ PyOS_snprintf(buf, sizeof(buf),
+ "problem with param %d", i);
PyErr_SetString(ErrorObject, buf);
goto error;
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3340131..37c0f86 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2555,7 +2555,7 @@ _PyPopenCreateProcess(char *cmdstring,
x = i + strlen(s3) + strlen(cmdstring) + 1;
s2 = (char *)_alloca(x);
ZeroMemory(s2, x);
- sprintf(s2, "%s%s%s", s1, s3, cmdstring);
+ PyOS_snprintf(s2, x, "%s%s%s", s1, s3, cmdstring);
}
else {
/*
@@ -2608,8 +2608,8 @@ _PyPopenCreateProcess(char *cmdstring,
s2 = (char *)_alloca(x);
ZeroMemory(s2, x);
- sprintf(
- s2,
+ PyOS_snprintf(
+ s2, x,
"%s \"%s%s%s\"",
modulepath,
s1,
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index eccee4d..db91d8b 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3089,7 +3089,8 @@ OS2init(void)
return 1; /* Indicate Success */
}
- sprintf(reason, "OS/2 TCP/IP Error# %d", sock_errno());
+ PyOS_snprintf(reason, sizeof(reason),
+ "OS/2 TCP/IP Error# %d", sock_errno());
PyErr_SetString(PyExc_ImportError, reason);
return 0; /* Indicate Failure */
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index 3c5de2b..54d444f 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -778,7 +778,8 @@ strop_atoi(PyObject *self, PyObject *args)
return NULL;
}
else if (errno != 0) {
- sprintf(buffer, "atoi() literal too large: %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "atoi() literal too large: %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
return NULL;
}
@@ -828,7 +829,8 @@ strop_atol(PyObject *self, PyObject *args)
while (*end && isspace(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
- sprintf(buffer, "invalid literal for atol(): %.200s", s);
+ PyOS_snprintf(buffer, sizeof(buffer),
+ "invalid literal for atol(): %.200s", s);
PyErr_SetString(PyExc_ValueError, buffer);
Py_DECREF(x);
return NULL;