diff options
author | Jonathan Boeing <jonathan.n.boeing@gmail.com> | 2015-02-09 20:01:39 -0700 |
---|---|---|
committer | Gene Cumm <gene.cumm@gmail.com> | 2015-05-03 10:52:34 -0400 |
commit | 4ab07cfbee420f43c02b8f6c51641f45191abd63 (patch) | |
tree | 6a7084d555cab4cfbacdd85a253446d8b1668bcb | |
parent | 8be34466cd4622f4071a3fae3c1dd32289d44b67 (diff) | |
download | syslinux-4ab07cfbee420f43c02b8f6c51641f45191abd63.tar.gz syslinux-4ab07cfbee420f43c02b8f6c51641f45191abd63.tar.xz syslinux-4ab07cfbee420f43c02b8f6c51641f45191abd63.zip |
hdt: fix sizeof(char *) misuse
The code was passing sizeof(const char *) - not the length of the string
or the size of the buffer - as the length to strncmp(). These two cases
don't need the length, so switch to strcmp.
Fixes the warning: argument to 'sizeof' in 'strncmp' call is the same
expression as the second source; did you mean to provide an explicit
length?
Signed-off-by: Jonathan Boeing <jonathan.n.boeing@gmail.com>
-rw-r--r-- | com32/hdt/hdt-cli.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index 2895b13c..776c8e8b 100644 --- a/com32/hdt/hdt-cli.c +++ b/com32/hdt/hdt-cli.c @@ -211,7 +211,7 @@ cli_mode_t mode_s_to_mode_t(char *name) int i = 0; while (list_modes[i]) { - if (!strncmp(name, list_modes[i]->name, sizeof(list_modes[i]->name))) + if (!strcmp(name, list_modes[i]->name)) break; i++; } @@ -288,8 +288,7 @@ static void expand_aliases(char *line __unused, char **command, char **module, /* Simple aliases mapping a single command to another one */ for (i = 0; i < MAX_ALIASES; i++) { for (j = 0; j < hdt_aliases[i].nb_aliases; j++) { - if (!strncmp(*command, hdt_aliases[i].aliases[j], - sizeof(hdt_aliases[i].aliases[j]))) { + if (!strcmp(*command, hdt_aliases[i].aliases[j])) { dprintf("CLI DEBUG: ALIAS %s ", *command); strlcpy(*command, hdt_aliases[i].command, sizeof(hdt_aliases[i].command) + 1); |