7158801: Improve VM CompileOnly option
authorkvn
Wed, 23 May 2012 12:11:25 -0700
changeset 14138 d62d6721cf2a
parent 12988 b31a90568395
child 14139 339b184759f9
7158801: Improve VM CompileOnly option Summary: Fixed buffer overflow during parsing flags -XX:CompileCommand=, -XX:CompileOnly= and command lines in .hotspot_compiler file. Reviewed-by: never
hotspot/src/share/vm/compiler/compilerOracle.cpp
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp	Mon May 21 14:56:33 2012 -0700
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Wed May 23 12:11:25 2012 -0700
@@ -572,7 +572,7 @@
   char token[1024];
   int  pos = 0;
   int  c = getc(stream);
-  while(c != EOF) {
+  while(c != EOF && pos < (sizeof(token)-1)) {
     if (c == '\n') {
       token[pos++] = '\0';
       parse_from_line(token);
@@ -593,7 +593,7 @@
   int  pos = 0;
   const char* sp = str;
   int  c = *sp++;
-  while (c != '\0') {
+  while (c != '\0' && pos < (sizeof(token)-1)) {
     if (c == '\n') {
       token[pos++] = '\0';
       parse_line(token);