JDK 10 RFR of 8186766: UnixNativeDispatcher.readlink0 truncates the result characters if the length of the result is more than PATH_MAX

Brian Burkhalter brian.burkhalter at oracle.com
Tue Aug 29 17:13:32 UTC 2017


The function readlink() returns the number of non-null characters in the length of the pathname contained by the link and if this happens to equal the size of the supplied buffer the last character will be overwritten with ‘\0’ yielding an incorrect result. The JNI readlink0() function is modified to dynamically allocate the buffer passed to readlink() and to re-check the link size after calling readlink() to ensure that the link size did not increase since first checked and if so to retry the sequence of operations.

The test is changed only to add the bug ID. Perhaps it would be better simply yo label the issue with “noreg-hard?"



More information about the nio-dev mailing list