changeset 2975:84f98de21493

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
author kvn
date Wed, 23 May 2012 12:11:25 -0700
parents c159737dd826
children 8b8c198ec5c4
files src/share/vm/compiler/compilerOracle.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compilerOracle.cpp	Fri Aug 31 21:58:49 2012 +0100
+++ b/src/share/vm/compiler/compilerOracle.cpp	Wed May 23 12:11:25 2012 -0700
@@ -573,7 +573,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);
@@ -594,7 +594,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);