Fix overflow in strv_null_terminate, and don't make it increase .cnt

This commit is contained in:
Nils O. Selåsdal
2013-10-01 22:30:39 +02:00
parent dd517a5d85
commit d619d58ccd
2 changed files with 3 additions and 2 deletions
+2 -2
View File
@@ -29,7 +29,8 @@ int uc_strv_expand(struct UCStrv *strv)
int rc = 0;
if (strv->cnt >= strv->allocated) {
rc = uc_strv_grow(strv, 1);
//make some extra room
rc = uc_strv_grow(strv, 4);
}
return rc;
@@ -81,7 +82,6 @@ int uc_strv_null_terminate(struct UCStrv *strv)
}
strv->strings[strv->cnt] = NULL;
strv->cnt++;
return 0;
}