diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 19:51:25 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 19:51:25 +0000 |
| commit | f4e477b5493313f4c920845ee2b69282b1b88c23 (patch) | |
| tree | f23d93561d16f8a9562128514328fd2204db797b | |
| parent | 687e64a359b4ca5c6b078e5db946be63ffd5b568 (diff) | |
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 <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 2 insertions, 3 deletions
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; } } |
