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

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 29 17:17:15 UTC 2017



On 29/08/2017 18:13, Brian Burkhalter wrote:
> https://bugs.openjdk.java.net/browse/JDK-8186766
> http://cr.openjdk.java.net/~bpb/8186766/webrev.00/
>
> 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?"
>
The readlink0 method should be a single wrapper around readlink. To 
address this will require change the wrapper method.

-Alan


More information about the nio-dev mailing list