From f4e477b5493313f4c920845ee2b69282b1b88c23 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 3 Mar 2026 19:51:25 +0000 Subject: util/nvmutil: don't bother with strncmp these are strings provided from the shell, which are guaranteed to always be null-terminated. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'util/nvmutil/nvmutil.c') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 720eb8ec..fdf93c67 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -69,7 +69,6 @@ static int fd; static int part; static int invert; static int part_modified[2]; -static int max_cmd_length = 50; static const char *mac = NULL; static const char *rmac = "xx:xx:xx:xx:xx:xx"; @@ -143,7 +142,7 @@ set_cmd(int argc, char *argv[]) } for (i = 0; (i < items(ops)) && (cmd == NULL); i++) { - if (strncmp(argv[2], ops[i].str, max_cmd_length) != 0) + if (strcmp(argv[2], ops[i].str) != 0) continue; if (argc >= ops[i].args) { cmd = ops[i].cmd; @@ -179,7 +178,7 @@ set_io_flags(int argc, char *argv[]) { flags = O_RDWR; if (argc > 2) { - if (strncmp(argv[2], "dump", 50) == 0) + if (strcmp(argv[2], "dump") == 0) flags = O_RDONLY; } } -- cgit v1.2.1