Skip to content
Snippets Groups Projects
Commit b924bf72 authored by Brian Burkhalter's avatar Brian Burkhalter
Browse files

8186766: UnixNativeDispatcher::readlink() may truncate overlong paths

Reviewed-by: alanb
parent 32ec91ca
Branches
Tags
No related merge requests found
...@@ -875,7 +875,10 @@ Java_sun_nio_fs_UnixNativeDispatcher_readlink0(JNIEnv* env, jclass this, ...@@ -875,7 +875,10 @@ Java_sun_nio_fs_UnixNativeDispatcher_readlink0(JNIEnv* env, jclass this,
} else { } else {
jsize len; jsize len;
if (n == sizeof(target)) { if (n == sizeof(target)) {
n--; /* Traditionally readlink(2) should not return more than */
/* PATH_MAX bytes (no terminating null byte is appended). */
throwUnixException(env, ENAMETOOLONG);
return NULL;
} }
target[n] = '\0'; target[n] = '\0';
len = (jsize)strlen(target); len = (jsize)strlen(target);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment