added warnings about security risk of using tmpnam and tempnam

This commit is contained in:
Skip Montanaro 2001-08-18 18:52:10 +00:00
parent 50d756e262
commit 95618b5bc9
1 changed files with 10 additions and 0 deletions

View File

@ -4211,6 +4211,11 @@ posix_tempnam(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx))
return NULL;
if (PyErr_Warn(PyExc_RuntimeWarning,
"tempnam is a potential security risk to your program") < 0)
return NULL;
#ifdef MS_WIN32
name = _tempnam(dir, pfx);
#else
@ -4258,6 +4263,11 @@ posix_tmpnam(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, ":tmpnam"))
return NULL;
if (PyErr_Warn(PyExc_RuntimeWarning,
"tmpnam is a potential security risk to your program") < 0)
return NULL;
#ifdef USE_TMPNAM_R
name = tmpnam_r(buffer);
#else