changeset 4558:0db060c0b2ae

[TEST] S6733959: Catch when Main-class attribute value exceeds string length limits.
author andrew
date Thu, 22 Sep 2011 01:19:41 +0100
parents 1aad084f039f
children bda2694959de
files src/share/bin/java.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/bin/java.c	Thu Sep 22 01:17:49 2011 +0100
+++ b/src/share/bin/java.c	Thu Sep 22 01:19:41 2011 +0100
@@ -894,8 +894,14 @@
      * "Valid" returns (other than unrecoverable errors) follow.  Set
      * main_class as a side-effect of this routine.
      */
-    if (info.main_class != NULL)
+    if (info.main_class != NULL) {
+      if (strlen(info.main_class) <= MAXNAMELEN) {
         *main_class = JLI_StringDup(info.main_class);
+      } else {
+        JLI_ReportErrorMessage("Error: main-class: attribute exceeds system limits\n", JNI_TRUE);
+	exit(1);
+      }
+    }
 
     /*
      * If no version selection information is found either on the command