aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-cli.c
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-26 23:33:53 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-26 23:33:53 -0700
commit8518be2b8e1a9b04d71239610757da22758cc363 (patch)
treee297a5da24e0322835fc30c345f7727e70edddd6 /com32/hdt/hdt-cli.c
parent81910f64ece4b1ca9e7e1ff276d673ef2321b1ea (diff)
downloadsyslinux-8518be2b8e1a9b04d71239610757da22758cc363.tar.gz
syslinux-8518be2b8e1a9b04d71239610757da22758cc363.tar.xz
syslinux-8518be2b8e1a9b04d71239610757da22758cc363.zip
hdt: Fix bug in module lookup (CLI)
Compare the exact length. The previous version allowed `show diskkkkkk' to match `show disk'. Using strcmp is safe here, both strings are null-terminated by construction. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt/hdt-cli.c')
-rw-r--r--com32/hdt/hdt-cli.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 6df2818f..5fe1436a 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -430,16 +430,14 @@ void find_cli_callback_descr(const char* module_name,
struct cli_callback_descr** module_found)
{
int modules_iter = 0;
- int module_len = strlen(module_name);
if (modules_list == NULL)
goto not_found;
/* Find the callback to execute */
while (modules_list->modules[modules_iter].name &&
- strncmp(module_name,
- modules_list->modules[modules_iter].name,
- strlen(modules_list->modules[modules_iter].name)) != 0)
+ strcmp(module_name,
+ modules_list->modules[modules_iter].name) != 0)
modules_iter++;
if (modules_list->modules[modules_iter].name) {