[PATCH] tools/x86/kcpuid: bound CSV field copies to avoid overflow

From: rafad900

Date: Sat May 02 2026 - 18:10:39 EST


I added bounded copies of the bit descriptions to avoid possible
overflows. I tested by compiling the tool and scp into qemu along with
the .csv file. Then ran the tool and saw no errors

Signed-off-by: rafad900 <19312533+rafad900@xxxxxxxxxxxxxxxxxxxxxxxx>
---
tools/arch/x86/kcpuid/kcpuid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/arch/x86/kcpuid/kcpuid.c b/tools/arch/x86/kcpuid/kcpuid.c
index 7dc6b9235d02..c17dbcf453eb 100644
--- a/tools/arch/x86/kcpuid/kcpuid.c
+++ b/tools/arch/x86/kcpuid/kcpuid.c
@@ -415,8 +415,8 @@ static void parse_line(char *line)

bdesc->end = bit_end;
bdesc->start = bit_start;
- strcpy(bdesc->simp, strtok(tokens[4], " \t"));
- strcpy(bdesc->detail, tokens[5]);
+ strncpy(bdesc->simp, strtok(tokens[4], " \t"), sizeof(bdesc->simp) - 1);
+ strncpy(bdesc->detail, tokens[5], sizeof(bdesc->detail) - 1);
}
return;

--
2.43.0