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 <juro.bystricky@intel.com>
This commit is contained in:
Juro Bystricky
2019-08-16 12:39:02 -07:00
committed by ajch
parent b2adc08d4f
commit 75255fff50
+1 -1
View File
@@ -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);