slist: validate separator position to avoid buffer overflow
@@ -95,6 +95,10 @@ int flb_slist_split_string(struct mk_list *list, const char *str,
if (end < 0) {
end = len - i;
}
+ else if (end == i) {
+ i++;
+ continue;
+ }
p_init = (char *) str + i;
p_end = p_init + end - 1;
@@ -103,6 +107,7 @@ int flb_slist_split_string(struct mk_list *list, const char *str,
while (*p_init == ' ') {
p_init++;
}
+
while (*p_end == ' ' && p_end >= p_init) {
p_end--;
}
