mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
7158801: Improve VM CompileOnly option
Fixed buffer overflow during parsing flags -XX:CompileCommand=, -XX:CompileOnly= and command lines in .hotspot_compiler file. Reviewed-by: never
This commit is contained in:
parent
1c1f4add53
commit
0a84e90eea
1 changed files with 2 additions and 2 deletions
|
@ -572,7 +572,7 @@ void CompilerOracle::parse_from_file() {
|
||||||
char token[1024];
|
char token[1024];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int c = getc(stream);
|
int c = getc(stream);
|
||||||
while(c != EOF) {
|
while(c != EOF && pos < (sizeof(token)-1)) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
token[pos++] = '\0';
|
token[pos++] = '\0';
|
||||||
parse_from_line(token);
|
parse_from_line(token);
|
||||||
|
@ -593,7 +593,7 @@ void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
const char* sp = str;
|
const char* sp = str;
|
||||||
int c = *sp++;
|
int c = *sp++;
|
||||||
while (c != '\0') {
|
while (c != '\0' && pos < (sizeof(token)-1)) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
token[pos++] = '\0';
|
token[pos++] = '\0';
|
||||||
parse_line(token);
|
parse_line(token);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue