mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-21 07:45:11 +00:00
8009984: [parfait] Buffer overrun at jdk/src/macosx/native/com/apple/laf/AquaFileView.m
Reviewed-by: serb, art
This commit is contained in:
parent
857a99a9e7
commit
3352552f34
@ -187,13 +187,13 @@ JNIEXPORT jstring JNICALL Java_com_apple_laf_AquaFileView_getNativePathForResolv
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
UInt8 pathCString[MAXPATHLEN + 1];
|
||||
size_t pathSize = sizeof(pathCString);
|
||||
size_t maxPathLen = sizeof(pathCString) - 1;
|
||||
|
||||
jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
|
||||
jsize length = (*env)->GetArrayLength(env, pathToAlias);
|
||||
|
||||
if (length > pathSize) {
|
||||
length = pathSize;
|
||||
if (length > maxPathLen) {
|
||||
length = maxPathLen;
|
||||
}
|
||||
strncpy((char *)pathCString, (char *)byteArray, length);
|
||||
// make sure it's null terminated
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user