[PATCH] lib: fwts_cpu: The string "flags" is 5 chars, fix incorrect strncmp size

Colin King colin.king at canonical.com
Thu Apr 13 10:16:55 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

Currently this string is being compared with a strncmp of size 4 bytes
instead of the correct string size of 5 bytes. Fix this.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
index 148857e4..90bae200 100644
--- a/src/lib/src/fwts_cpu.c
+++ b/src/lib/src/fwts_cpu.c
@@ -160,7 +160,7 @@ fwts_cpuinfo_x86 *fwts_cpu_get_info(int which_cpu)
 			sscanf(ptr, "%d", &cpu->stepping);
 			continue;
 		}
-		if (!strncmp(buffer, "flags", 4)) {
+		if (!strncmp(buffer, "flags", 5)) {
 			cpu->flags = strdup(ptr);
 			continue;
 		}
-- 
2.11.0




More information about the fwts-devel mailing list