summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mac/Modules/hfsplusmodule.c8
-rw-r--r--Mac/Modules/macfsmodule.c2
-rw-r--r--Mac/Python/macimport.c8
3 files changed, 9 insertions, 9 deletions
diff --git a/Mac/Modules/hfsplusmodule.c b/Mac/Modules/hfsplusmodule.c
index 56c9cca..425bdb8 100644
--- a/Mac/Modules/hfsplusmodule.c
+++ b/Mac/Modules/hfsplusmodule.c
@@ -1251,9 +1251,9 @@ PyObject *macos_error_for_call(OSErr err, const char *name, const char *item)
char buffer[1024];
if (item)
- sprintf(buffer, "mac error calling %s on %s", name, item);
+ PyOS_snprintf(buffer, sizeof(buffer), "mac error calling %s on %s", name, item);
else
- sprintf(buffer, "mac error calling %s", name);
+ PyOS_snprintf(buffer, sizeof(buffer), "mac error calling %s", name);
v = Py_BuildValue("(is)", err, buffer);
if (v != NULL) {
@@ -1376,9 +1376,9 @@ void printableUniStr(const HFSUniStr255 *uni, char *buffer)
UniChar uch = uni->unicode[i];
if ((uch & 0x7f) == uch) {
- sprintf(localbuf, "%c", uch);
+ PyOS_snprintf(localbuf, sizeof(localbuf), "%c", uch);
} else {
- sprintf(localbuf, "\\u%04x", uch);
+ PyOS_snprintf(localbuf, sizeof(localbuf), "\\u%04x", uch);
}
strcat(buffer, localbuf);
}
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c
index 9b635e3..26d7d7f 100644
--- a/Mac/Modules/macfsmodule.c
+++ b/Mac/Modules/macfsmodule.c
@@ -706,7 +706,7 @@ mfss_repr(mfssobject *self)
{
char buf[512];
- sprintf(buf, "FSSpec((%d, %ld, '%.*s'))",
+ PyOS_snprintf(buf, sizeof(buf), "FSSpec((%d, %ld, '%.*s'))",
self->fsspec.vRefNum,
self->fsspec.parID,
self->fsspec.name[0], self->fsspec.name+1);
diff --git a/Mac/Python/macimport.c b/Mac/Python/macimport.c
index b6c2d88..49d1b14 100644
--- a/Mac/Python/macimport.c
+++ b/Mac/Python/macimport.c
@@ -223,7 +223,7 @@ PyMac_LoadCodeResourceModule(name, pathname)
packagecontext = name;
shortname = lastdot+1;
}
- sprintf(funcname, FUNCNAME_PATTERN, shortname);
+ PyOS_snprintf(funcname, sizeof(funcname), FUNCNAME_PATTERN, shortname);
if( !findnamedresource((PyStringObject *)0, name, pathname, 'PYD ', fragmentname)) {
PyErr_SetString(PyExc_ImportError, "PYD resource not found");
return NULL;
@@ -235,7 +235,7 @@ PyMac_LoadCodeResourceModule(name, pathname)
kLoadCFrag, &connID, &mainAddr,
errMessage);
if ( err ) {
- sprintf(buf, "%.*s: %.200s",
+ PyOS_snprintf(buf, sizeof(buf), "%.*s: %.200s",
errMessage[0], errMessage+1,
PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
@@ -244,7 +244,7 @@ PyMac_LoadCodeResourceModule(name, pathname)
/* Locate the address of the correct init function */
err = FindSymbol(connID, Pstring(funcname), &symAddr, &class);
if ( err ) {
- sprintf(buf, "%s: %.200s",
+ PyOS_snprintf(buf, sizeof(buf), "%s: %.200s",
funcname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
@@ -405,7 +405,7 @@ error:
{
char buf[512];
- sprintf(buf, "%s: %s", filename, PyMac_StrError(err));
+ PyOS_snprintf(buf, sizeof(buf), "%s: %s", filename, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
}