8329961: Buffer overflow in os::Linux::kernel_version
Reviewed-by: rehn, stuefe
This commit is contained in:
parent
9731b1c8b0
commit
279ed0ddd5
@ -377,16 +377,9 @@ void os::Linux::kernel_version(long* major, long* minor) {
|
|||||||
log_warning(os)("uname(2) failed to get kernel version: %s", os::errno_name(ret));
|
log_warning(os)("uname(2) failed to get kernel version: %s", os::errno_name(ret));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int nr_matched = sscanf(buffer.release, "%ld.%ld", major, minor);
|
||||||
char* walker = buffer.release;
|
if (nr_matched != 2) {
|
||||||
long* set_v = major;
|
log_warning(os)("Parsing kernel version failed, expected 2 version numbers, only matched %d", nr_matched);
|
||||||
while (*minor == -1 && walker != nullptr) {
|
|
||||||
if (isdigit(walker[0])) {
|
|
||||||
*set_v = strtol(walker, &walker, 10);
|
|
||||||
set_v = minor;
|
|
||||||
} else {
|
|
||||||
++walker;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user