hdt: Prevent auto mode from using empty commands
authorErwan Velu <erwan.velu@free.fr>
Thu, 5 Nov 2009 16:39:20 +0000 (17:39 +0100)
committerErwan Velu <erwan.velu@free.fr>
Thu, 5 Nov 2009 16:39:20 +0000 (17:39 +0100)
Impact: prevent running stupid commands

The code didn't prevents from executing stupid "'" commands

com32/hdt/hdt-cli.c

index f395260..fdb10e4 100644 (file)
@@ -763,7 +763,7 @@ void start_auto_mode(struct s_hardware *hardware)
        /* Searching & saving all commands */
         mypch = strtok (temp,AUTO_SEPARATOR);
         while (mypch != NULL) {
-               if (strlen(remove_spaces(mypch))>0) {
+               if ((strlen(remove_spaces(mypch))>0) && (remove_spaces(mypch)[0] !='\'')) {
                        nb_commands++;
                        if ((commands[nb_commands]=malloc(AUTO_COMMAND_SIZE)) != NULL) {
                                sprintf(commands[nb_commands],"%s",remove_spaces(mypch));