diff --git a/apps/mosquitto_ctrl/ctrl_shell_dynsec.c b/apps/mosquitto_ctrl/ctrl_shell_dynsec.c index 222b02c0..b2775dda 100644 --- a/apps/mosquitto_ctrl/ctrl_shell_dynsec.c +++ b/apps/mosquitto_ctrl/ctrl_shell_dynsec.c @@ -620,6 +620,11 @@ static void line_callback(char *line) char *saveptr = NULL; char *command = strtok_r(line, " ", &saveptr); + if(!command){ + free(line); + return; + } + if(!strcasecmp(command, "addClientRole")){ ctrl_shell_command_generic_arg2("addClientRole", "username", "rolename", &saveptr); }else if(!strcasecmp(command, "addGroupClient")){ diff --git a/apps/mosquitto_ctrl/ctrl_shell_post_connect.c b/apps/mosquitto_ctrl/ctrl_shell_post_connect.c index 0c284298..4f6c772b 100644 --- a/apps/mosquitto_ctrl/ctrl_shell_post_connect.c +++ b/apps/mosquitto_ctrl/ctrl_shell_post_connect.c @@ -97,8 +97,13 @@ static void line_callback(char *line) } char *saveptr = NULL; - char *command = strtok_r(line, " ", &saveptr); bool found = false; + char *command = strtok_r(line, " ", &saveptr); + + if(!command){ + free(line); + return; + } for(size_t i=0; i