A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056373.html below:

[Python-Dev] unintentional and unsafe use of realpath()

[Python-Dev] unintentional and unsafe use of realpath()Greg Ewing greg.ewing at canterbury.ac.nz
Mon Sep 12 07:23:53 CEST 2005
Peter Jones wrote:

> Another problem (which I have not fixed) is that when realpath() is
> used, in some cases MAXPATHLEN is smaller than the system's
> PATH_MAX/pathconf(path, _PC_PATH_MAX).

The linux man page for realpath() has this at the bottom:

BUGS
        Never  use this function. It is broken by design since it is impossible
        to determine a suitable size for the output buffer.  According to POSIX
        a  buffer of size PATH_MAX suffices, but PATH_MAX need not be a defined
        constant, and may have to be obtained  using  pathconf().   And  asking
        pathconf() does not really help, since on the one hand POSIX warns that
        the result of pathconf() may be huge and unsuitable for mallocing  mem-
        ory.  And  on  the  other hand pathconf() may return -1 to signify that
        PATH_MAX is not bounded.

So maybe it shouldn't be using realpath() at all?

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4