jdk/src/windows/bin/java_md.c
changeset 6535 77ffd0e75bfb
parent 6522 1e468849b92c
child 7028 adadd244f506
child 7004 3f92ea1ffcac
--- a/jdk/src/windows/bin/java_md.c	Wed Sep 08 17:10:04 2010 -0700
+++ b/jdk/src/windows/bin/java_md.c	Thu Sep 09 11:50:40 2010 -0700
@@ -162,6 +162,10 @@
 #endif
 #ifdef CRT_DLL
         if (GetJREPath(crtpath, MAXPATHLEN)) {
+            if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") + JLI_StrLen(CRT_DLL) >= MAXPATHLEN) {
+                JLI_ReportErrorMessage(JRE_ERROR11);
+                return JNI_FALSE;
+            }
             (void)JLI_StrCat(crtpath, "\\bin\\" CRT_DLL);   /* Add crt dll */
             JLI_TraceLauncher("CRT path is %s\n", crtpath);
             if (_access(crtpath, 0) == 0) {
@@ -852,8 +856,7 @@
     /*
      * If this isn't the selected version, exec the selected version.
      */
-    (void)JLI_StrCat(JLI_StrCat(JLI_StrCpy(path, jre), "\\bin\\"), progname);
-    (void)JLI_StrCat(path, ".exe");
+    JLI_Snprintf(path, sizeof(path), "%s\\bin\\%s.exe", jre, progname);
 
     /*
      * Although Windows has an execv() entrypoint, it doesn't actually