diff --git a/src/core/command_parser.c b/src/core/command_parser.c index 01b8b15..8247bcd 100644 --- a/src/core/command_parser.c +++ b/src/core/command_parser.c @@ -64,6 +64,7 @@ static enum command_parse_status command_extract_arguments(struct hub_info* hub, char* token = NULL; char* tmp = NULL; size_t size = 0; + size_t offset = 0; struct hub_command_arg_data* data = NULL; enum command_parse_status status = cmd_status_ok; @@ -82,9 +83,10 @@ static enum command_parse_status command_extract_arguments(struct hub_info* hub, while ((tmp = list_get_first(tokens))) { - if (*token) - strcat(token, " "); - strcat(token, tmp); + if (offset > 0) + token[offset++] = ' '; + memcpy(token + offset, tmp, strlen(tmp)); + offset += strlen(tmp); list_remove(tokens, tmp); hub_free(tmp); }