forked from Mirrors/badapplefetch
check bounds
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
3ce12d7ab1
commit
fa7b78f1ff
1 changed files with 2 additions and 2 deletions
|
@ -257,8 +257,8 @@ unsigned char CPU_init(CPU *cpu) {
|
||||||
if (strncmp(line, "model name", 10) == 0) {
|
if (strncmp(line, "model name", 10) == 0) {
|
||||||
strncpy(cpu->model, strchr(line, ':') + 2, 64);
|
strncpy(cpu->model, strchr(line, ':') + 2, 64);
|
||||||
cpu->model[strcspn(cpu->model, "\n")] = 0;
|
cpu->model[strcspn(cpu->model, "\n")] = 0;
|
||||||
} else if (strncmp(line, "processor", 9) == 0)
|
} else if (strncmp(line, "processor", 9) == 0 && cpu->core_count < 255)
|
||||||
cpu->core_count += (uint8_t)1;
|
cpu->core_count += 1;
|
||||||
|
|
||||||
fclose(fp_cpu);
|
fclose(fp_cpu);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue