diff --git a/services/utils/init_utils.c b/services/utils/init_utils.c index ac2a52c8ba7a0e3d1e2f0da1953df71cd6f518a3..6774e738c3dc0d1f9a51189507d8f84b7964e390 100755 --- a/services/utils/init_utils.c +++ b/services/utils/init_utils.c @@ -196,9 +196,11 @@ int SplitString(char *srcPtr, const char *del, char **dstPtr, int maxNum) int counter = 0; while (dstPtr[counter] != NULL && (counter < maxNum)) { counter++; + if (counter >= maxNum) { + break; + } dstPtr[counter] = strtok_r(NULL, del, &buf); } - dstPtr[counter] = NULL; return counter; }