mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Fail on out-of-range CPU number
Found by Coverity
This commit is contained in:
parent
df41979afc
commit
af84d3dfa9
@ -1235,7 +1235,7 @@ static inline double LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
|
||||
(sscanf(buffer, "cpu MHz : %lf", &frequency) == 1) ||
|
||||
(sscanf(buffer, "cpu MHz: %lf", &frequency) == 1)
|
||||
) {
|
||||
if (cpuid < 0) {
|
||||
if (cpuid < 0 || cpuid > (cpus - 1)) {
|
||||
CRT_fatalError(PROCCPUINFOFILE " is malformed: cpu MHz line without corresponding processor line");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user