8073773: Presume path preparedness

Reviewed-by: darcy, dholmes, ahgross
This commit is contained in:
Kumar Srinivasan 2015-03-02 08:19:11 -08:00
parent 5f7a2dfec6
commit 8c4275fcb7
3 changed files with 24 additions and 5 deletions

View file

@ -323,7 +323,11 @@ GetJREPath(char *path, jint pathsize)
JLI_TraceLauncher("JRE path is %s\n", path);
return JNI_TRUE;
}
/* ensure storage for path + \jre + NULL */
if ((JLI_StrLen(path) + 4 + 1) > (size_t) pathsize) {
JLI_TraceLauncher("Insufficient space to store JRE path\n");
return JNI_FALSE;
}
/* Does this app ship a private JRE in <apphome>\jre directory? */
JLI_Snprintf(javadll, sizeof (javadll), "%s\\jre\\bin\\" JAVA_DLL, path);
if (stat(javadll, &s) == 0) {