blob: 91d1464eafbdcadd9002041eb5161b10da2fced6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# HG changeset patch
# User kvn
# Date 1337800285 25200
# Node ID f7493d50b47d3946902e18153bcd912e37589d00
# Parent 2faa3f7bad65189e69ab2f9a491743786bb8f07f
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
diff --git a/src/share/vm/compiler/compilerOracle.cpp b/src/share/vm/compiler/compilerOracle.cpp
--- hotspot/src/share/vm/compiler/compilerOracle.cpp
+++ hotspot/src/share/vm/compiler/compilerOracle.cpp
@@ -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);
|