aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime/globals.cpp
diff options
context:
space:
mode:
authornever <none@none>2008-09-25 12:50:51 -0700
committernever <none@none>2008-09-25 12:50:51 -0700
commit034a3ce309d37ddc3ca1081e77a20e976fc6cd7c (patch)
treed6fb903aaf497c6db6358b5f37dc60ac2bf35bd7 /src/share/vm/runtime/globals.cpp
parent0434ead219f6fb9d449ebf2fb706f927cb0bb295 (diff)
6744783: HotSpot segfaults if given -XX options with an empty string argument
Reviewed-by: kamg, kvn Contributed-by: volker.simonis@gmail.com
Diffstat (limited to 'src/share/vm/runtime/globals.cpp')
-rw-r--r--src/share/vm/runtime/globals.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp
index 5adadcb98..5e1774f5e 100644
--- a/src/share/vm/runtime/globals.cpp
+++ b/src/share/vm/runtime/globals.cpp
@@ -355,8 +355,11 @@ bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, FlagValu
if (result == NULL) return false;
if (!result->is_ccstr()) return false;
ccstr old_value = result->get_ccstr();
- char* new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1);
- strcpy(new_value, *value);
+ char* new_value = NULL;
+ if (*value != NULL) {
+ new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1);
+ strcpy(new_value, *value);
+ }
result->set_ccstr(new_value);
if (result->origin == DEFAULT && old_value != NULL) {
// Prior value is NOT heap allocated, but was a literal constant.