If exactly one argument is given to the sender command, and this
argument is the name of an existing sender, the sender command
segfaults due to the NULL pointer dereference. The problem is an
off-by-one bug in the check for the number of arguments.
This patch makes sure we never dereference argv[2] if it is NULL.
const char *subcmds[] = {"add", "delete", "allow", "deny", "on", "off", NULL};
scd->sender_num = -1;
- if (argc < 2)
+ if (argc < 3)
return -E_COMMAND_SYNTAX;
for (i = 0; senders[i].name; i++)
if (!strcmp(senders[i].name, argv[1]))