aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2015-08-14 09:22:14 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2015-09-04 17:57:52 +0200
commit87472a3dd1827594832875ba4dab67d1d69b60da (patch)
tree679b8a13eadfc8e10df6f615f74d17c22e1d5381
parent5c6e28dc56ea03c9af557214801ab45f256cd981 (diff)
downloadsyslinux-87472a3dd1827594832875ba4dab67d1d69b60da.tar.gz
syslinux-87472a3dd1827594832875ba4dab67d1d69b60da.tar.xz
syslinux-87472a3dd1827594832875ba4dab67d1d69b60da.zip
hdt: Avoid false-positive single command detection
Since commit 1697594b61f9a8f9d092996afc0e2c80bbb2a20a, some commands are said to be "nomodule" like "say". This patch was adding a check if the nomodule flag was set but didn't checked that the associated structure did exist leading to false positive detection. As a result, the commands were not executed meaning the CLI was unsuable since ... 3 years.... *shame* This commit simply avoid considering the nomodule flag if the structure is not allocated
-rw-r--r--com32/hdt/hdt-cli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 64f07bb9..9d3c2a0c 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -635,7 +635,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
find_cli_callback_descr(command, current_mode->default_modules,
&current_module);
- if ((module == NULL) || (current_module->nomodule == true)) {
+ if ((module == NULL) || ((current_module != NULL) && current_module->nomodule == true)) {
dprintf("CLI DEBUG exec : single command detected\n");
/*
* A single word was specified: look at the list of default
@@ -645,7 +645,7 @@ static void exec_command(char *line, struct s_hardware *hardware)
*/
/* First of all it the command doesn't need module, let's rework the arguments */
- if ((current_module->nomodule == true) && ( module != NULL)) {
+ if (((current_module != NULL) && (current_module->nomodule == true)) && ( module != NULL)) {
dprintf("CLI_DEBUG exec: Reworking arguments with argc=%d\n",argc);
char **new_argv=NULL;
new_argv=malloc((argc + 2)*sizeof(char *));