Merge "Rest API: Fix all the bugs in the HWLB, mask issue, etc"
[samplevnf.git] / common / vnf_common / vnf_common.c
index 93687fd..ff0039b 100644 (file)
@@ -141,10 +141,11 @@ void trim(char *input)
        char result[len + 1];
 
        memset(result, 0, sizeof(result));
-       for (i = 0; input[i] != '\0'; i++) {
+       for (i = 0; (input[i] != '\0') && (i < PIPELINE_MAX_ARGS); i++) {
                if (!isspace(input[i]))
                        result[j++] = input[i];
        }
+       result[j] = '\0';
 
-       strncpy(input, result, len);
+       strncpy(input, result, strlen(result));
 }