From 75255fff50c84701b9f61eb384267ce526a1dc40 Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Fri, 16 Aug 2019 12:39:02 -0700 Subject: [PATCH] telemdaemon.c: don't assume correct machine_id length "fscanf" assumes an arbitrarily long string, so limit the scan to 32 characters to avoid a potential buffer overflow. Signed-off-by: Juro Bystricky --- src/telemdaemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/telemdaemon.c b/src/telemdaemon.c index d72b9e1..8143a05 100644 --- a/src/telemdaemon.c +++ b/src/telemdaemon.c @@ -430,7 +430,7 @@ bool get_machine_id(char *machine_id) return false; } - ret = fscanf(id_file, "%s", machine_id); + ret = fscanf(id_file, "%32s", machine_id); if (ret != 1) { telem_perror("Could not read machine id from file"); fclose(id_file);