8009984: [parfait] Buffer overrun at jdk/src/macosx/native/com/apple/laf/AquaFileView.m
Reviewed-by: serb, art
--- a/jdk/src/macosx/native/com/apple/laf/AquaFileView.m Tue Jun 11 16:02:22 2013 +0400
+++ b/jdk/src/macosx/native/com/apple/laf/AquaFileView.m Tue Jun 11 16:30:34 2013 +0400
@@ -187,13 +187,13 @@
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