diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-28 20:42:20 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-28 20:42:20 (GMT) |
commit | 518ab1c02a01a1a502fedeccb62ea73f2a952ba7 (patch) | |
tree | 4fd0238c7960f0001e8b576656acbbbe0947053e /Python/dynload_mac.c | |
parent | ef58b319916f6cf2034acc40b411f8405f20416f (diff) | |
download | cpython-518ab1c02a01a1a502fedeccb62ea73f2a952ba7.zip cpython-518ab1c02a01a1a502fedeccb62ea73f2a952ba7.tar.gz cpython-518ab1c02a01a1a502fedeccb62ea73f2a952ba7.tar.bz2 |
Use PyOS_snprintf instead of sprintf.
Diffstat (limited to 'Python/dynload_mac.c')
-rw-r--r-- | Python/dynload_mac.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Python/dynload_mac.c b/Python/dynload_mac.c index c8c9646..bb5f4fb 100644 --- a/Python/dynload_mac.c +++ b/Python/dynload_mac.c @@ -66,7 +66,8 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething); #endif if ( err ) { - sprintf(buf, "%.200s: %.200s", pathname, PyMac_StrError(err)); + PyOS_snprintf(buf, sizeof(buf), + "%.200s: %.200s", pathname, PyMac_StrError(err)); PyErr_SetString(PyExc_ImportError, buf); return NULL; } @@ -91,25 +92,26 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, ** the dynamic module was meant for a different Python. */ if (errMessage[0] == 10 && strncmp((char *)errMessage+1, "PythonCore", 10) == 0 ) { - sprintf(buf, "Dynamic module was built for %s version of MacPython", - (err == cfragImportTooOldErr ? "a newer" : "an older")); + PyOS_snprintf(buf, sizeof(buf), + "Dynamic module was built for %s version of MacPython", + (err == cfragImportTooOldErr ? "a newer" : "an older")); PyErr_SetString(PyExc_ImportError, buf); return NULL; } } 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); return NULL; } /* Locate the address of the correct init function */ - sprintf(funcname, "init%.200s", shortname); + PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname); err = FindSymbol(connID, Pstring(funcname), &symAddr, &class); if ( err ) { - sprintf(buf, "%s: %.200s", - funcname, PyMac_StrError(err)); + PyOS_snprintf(buf, sizeof(buf), "%s: %.200s", + funcname, PyMac_StrError(err)); PyErr_SetString(PyExc_ImportError, buf); return NULL; } |