STINNER Victor added the comment:

The putwin() function uses mkstemp() with the path template 
/tmp/py.curses.getwin.XXXXXX.

I would prefer to use the Python function tempfile.mkstemp(). This function has 
a more portable behaviour. For example, Python is able to atomatically make the 
file descriptor non-inherirable if the OS supports this feature.

I suggest to expect a file descriptor in the C putwin() and write a Python 
putwin() which expects a file and pass file.fileno() if available, or use 
tempfile.TemporaryFile().

tempfile.TemporaryFile is even more secure because the file is not accessible 
from the regular file system on most platforms. This function is able to use 
the secure Linux O_TMPFILE flag and the O_TEMPORARY flag on Windows.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29176>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to