Check btime sscanf parse from /proc/stat

Found by Coverity
This commit is contained in:
Christian Göttsche 2020-08-28 15:34:24 +02:00
parent a850d81bf5
commit 5c99c6e942
1 changed files with 2 additions and 1 deletions

View File

@ -275,7 +275,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
} else if (String_startsWith(buffer, "cpu")) {
cpus++;
} else if (String_startsWith(buffer, "btime ")) {
sscanf(buffer, "btime %lld\n", &btime);
if (sscanf(buffer, "btime %lld\n", &btime) != 1)
CRT_fatalError("Failed to parse btime from " PROCSTATFILE);
break;
}
} while(true);