Mercurial > hg > release > icedtea7-forest-2.2 > hotspot
changeset 3473:90113e624cb5
7158804: Improve config file parsing
Summary: Check buffer length when reading
Reviewed-by: dholmes, dcubed
author | kamg |
---|---|
date | Fri, 08 Jun 2012 12:49:52 -0400 |
parents | bf008614846d |
children | b86d003a0ed6 |
files | src/share/vm/compiler/compilerOracle.cpp src/share/vm/runtime/arguments.cpp |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/compiler/compilerOracle.cpp Wed May 23 12:11:25 2012 -0700 +++ b/src/share/vm/compiler/compilerOracle.cpp Fri Jun 08 12:49:52 2012 -0400 @@ -573,7 +573,7 @@ char token[1024]; int pos = 0; int c = getc(stream); - while(c != EOF && pos < (sizeof(token)-1)) { + while(c != EOF && pos < (int)(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' && pos < (sizeof(token)-1)) { + while (c != '\0' && pos < (int)(sizeof(token)-1)) { if (c == '\n') { token[pos++] = '\0'; parse_line(token);
--- a/src/share/vm/runtime/arguments.cpp Wed May 23 12:11:25 2012 -0700 +++ b/src/share/vm/runtime/arguments.cpp Fri Jun 08 12:49:52 2012 -0400 @@ -856,7 +856,7 @@ bool result = true; int c = getc(stream); - while(c != EOF) { + while(c != EOF && pos < (int)(sizeof(token)-1)) { if (in_white_space) { if (in_comment) { if (c == '\n') in_comment = false;