diff --git a/client/pyscripts/pm3_help2list.py b/client/pyscripts/pm3_help2list.py index abda16a5a..637e10e6d 100755 --- a/client/pyscripts/pm3_help2list.py +++ b/client/pyscripts/pm3_help2list.py @@ -121,7 +121,12 @@ char* rl_command_generator(const char *text, int state) { index++; if (strncmp (command, rl_line_buffer, rlen) == 0) { - return strdup(command + (rlen - len)); + const char *next = command + (rlen - len); + const char *space = strstr(next, " "); + if (space != NULL) { + return strndup(next, space - next); + } + return strdup(next); } } diff --git a/client/src/rl_vocabulory.h b/client/src/rl_vocabulory.h index 535b00a2b..ae74f3f8f 100644 --- a/client/src/rl_vocabulory.h +++ b/client/src/rl_vocabulory.h @@ -731,7 +731,12 @@ char* rl_command_generator(const char *text, int state) { index++; if (strncmp (command, rl_line_buffer, rlen) == 0) { - return strdup(command + (rlen - len)); + const char *next = command + (rlen - len); + const char *space = strstr(next, " "); + if (space != NULL) { + return strndup(next, space - next); + } + return strdup(next); } }