No error is reported during command line parsing when a payload pattern is
found with no command. It is not really a big deal because when the command
is processed, because there is no command, nothing is executed. It is
harmless.
But, accordingly to the doc, the payload is the last argument of a
command. So a command is required. Thus, an error is now reported when a
payload is received with no command.
This patch could be backported to 3.4. Older versions could benefit of this
patch. If we decide to backport it farther, the patch will have to be
adapted.
continue;
}
+ while (*str && (*str == ' ' || *str == '\t')) {
+ str++;
+ len--;
+ }
+
if (!len)
goto process_cmdline;
if (strncmp(last_arg, PAYLOAD_PATTERN, strlen(PAYLOAD_PATTERN)) == 0) {
ssize_t pat_len = strlen(last_arg) - strlen(PAYLOAD_PATTERN);
+ if (str == last_arg) {
+ cli_err(appctx, "The payload cannot be passed without command.\n");
+ goto error;
+ }
+
/* A customized pattern can't be more than 64 characters
* if it's more, don't make it a payload
*/