In case a command iwthout further options was given, p pointed one
byte after the malloced string, and this pointer is passed to the
command handler..
char *p = cmd + strcspn(cmd, delim);
int ret = -E_SYNTAX;
char *p = cmd + strcspn(cmd, delim);
int ret = -E_SYNTAX;
+ if (*p == '\0')
+ p = NULL;
+ else {
+ *p = '\0';
+ p++;
+ }
for (i = 0; icmds[i].name; i++) {
ERROR_LOG("name: %s, cmd: %s.\n", icmds[i].name, cmd);
if (strcmp(icmds[i].name, cmd))
for (i = 0; icmds[i].name; i++) {
ERROR_LOG("name: %s, cmd: %s.\n", icmds[i].name, cmd);
if (strcmp(icmds[i].name, cmd))