Replace sprintf() with PyOS_snprintf().
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 @@
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 @@
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 @@
{
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);