8037046: Validate libraries to be loaded
authorkizune
Sat, 22 Mar 2014 02:21:11 +0400
changeset 25538 421c18d84c71
parent 25537 087de200d457
child 25539 9d290547d266
8037046: Validate libraries to be loaded Reviewed-by: ksrini, ahgross
jdk/src/windows/bin/java_md.c
--- a/jdk/src/windows/bin/java_md.c	Mon Jul 14 13:57:44 2014 +0400
+++ b/jdk/src/windows/bin/java_md.c	Sat Mar 22 02:21:11 2014 +0400
@@ -1306,6 +1306,14 @@
             /* save path length */
             jrePathLen = JLI_StrLen(libraryPath);
 
+            if (jrePathLen + JLI_StrLen("\\bin\\verify.dll") >= MAXPATHLEN) {
+              /* jre path is too long, the library path will not fit there;
+               * report and abort preloading
+               */
+              JLI_ReportErrorMessage(JRE_ERROR11);
+              break;
+            }
+
             /* load msvcrt 1st */
             LoadMSVCRT();