From 5c99c6e942d5346bdac77d11eece9e2d60db4191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 28 Aug 2020 15:34:24 +0200 Subject: Check btime sscanf parse from /proc/stat Found by Coverity --- linux/LinuxProcessList.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index afdbc5fd..e426785f 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -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); -- cgit v1.2.3