[syslinux:master] hdt: Avoid false-positive single command detection
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Fri Sep 4 09:15:04 PDT 2015
Commit-ID: 87472a3dd1827594832875ba4dab67d1d69b60da
Gitweb: http://www.syslinux.org/commit/87472a3dd1827594832875ba4dab67d1d69b60da
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Fri, 14 Aug 2015 09:22:14 +0200
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Fri, 4 Sep 2015 17:57:52 +0200
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
---
com32/hdt/hdt-cli.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 64f07bb..9d3c2a0 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,
¤t_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 *));
More information about the Syslinux-commits
mailing list