summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-30 19:07:54 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-30 19:07:54 (GMT)
commitbc2472db8eeee545a2d815ec2e9ee71132d3b20c (patch)
treef18d37bc9b6448a06679e0822e63cb6da2590f75 /Python
parent15e33a4c42c9afacbe93eb4e3102a5e068e292eb (diff)
downloadcpython-bc2472db8eeee545a2d815ec2e9ee71132d3b20c.zip
cpython-bc2472db8eeee545a2d815ec2e9ee71132d3b20c.tar.gz
cpython-bc2472db8eeee545a2d815ec2e9ee71132d3b20c.tar.bz2
Avoid some potential (though unlikely) sprintf buffer overflows.
Diffstat (limited to 'Python')
-rw-r--r--Python/importdl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 16271d6..605d9a6 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -298,7 +298,8 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
(void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec);
err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething);
if ( err ) {
- sprintf(buf, "%s: %s", pathname, PyMac_StrError(err));
+ sprintf(buf, "%.255s: %.200s",
+ pathname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
}
@@ -318,7 +319,8 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
kLoadCFrag, &connID, &mainAddr,
errMessage);
if ( err ) {
- sprintf(buf, "%.*s: %s", errMessage[0], errMessage+1,
+ sprintf(buf, "%.*s: %.200s",
+ errMessage[0], errMessage+1,
PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
@@ -326,7 +328,8 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
/* Locate the address of the correct init function */
err = FindSymbol(connID, Pstring(funcname), &symAddr, &class);
if ( err ) {
- sprintf(buf, "%s: %s", funcname, PyMac_StrError(err));
+ sprintf(buf, "%s: %.200s",
+ funcname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
}