< prev index next >

src/os/posix/vm/os_posix.hpp

Print this page
rev 12684 : 8173848: realpath is unsafe
Summary: Fix occurrences of realpath in hotspot to use safe POSIX.1-2008 form, if possible.
Reviewed-by:
rev 12685 : [mq]: 8173828-realpath-is-unsafe-2

*** 98,108 **** // A safe implementation of realpath which will not cause a buffer overflow if the resolved path // is longer than PATH_MAX. // On success, it will return a pointer to the input buffer. // On error, it will return NULL and set errno. Content of output buffer is undefined. ! // On truncation error (output buffer too small), it will return NULL and set errno to EINVAL. static char* realpath(const char* filename, char* outbuf, size_t outbuflen); }; /* --- 98,108 ---- // A safe implementation of realpath which will not cause a buffer overflow if the resolved path // is longer than PATH_MAX. // On success, it will return a pointer to the input buffer. // On error, it will return NULL and set errno. Content of output buffer is undefined. ! // On truncation error (output buffer too small), it will return NULL and set errno to ENAMETOOLONG. static char* realpath(const char* filename, char* outbuf, size_t outbuflen); }; /*
< prev index next >