提交 0938b19d 编写于 作者: A alexsch

8009984: [parfait] Buffer overrun at jdk/src/macosx/native/com/apple/laf/AquaFileView.m

Reviewed-by: serb, art
上级 a994d182
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册