changeset 7336:7bba0147ab3d

8009984: [parfait] Buffer overrun at jdk/src/macosx/native/com/apple/laf/AquaFileView.m Reviewed-by: serb, art
author alexsch
date Tue, 11 Jun 2013 16:30:34 +0400
parents 59dc1385127f
children 33fc8a062f90
files src/macosx/native/com/apple/laf/AquaFileView.m
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/com/apple/laf/AquaFileView.m	Tue Jun 11 16:02:22 2013 +0400
+++ b/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