fixed potential buffer overflow discovered by Fernando Arnaboldi of IOActive

This commit is contained in:
Michael Rash
2012-09-01 23:37:03 -04:00
parent e3a78a175c
commit 86b403dadb
+12
View File
@@ -501,6 +501,12 @@ expand_acc_string_list(acc_string_list_t **stlist, char *stlist_str)
while(isspace(*start))
start++;
if(((ndx-start)+1) >= 1024)
{
fprintf(stderr, "Fatal str->list too long");
exit(EXIT_FAILURE);
}
strlcpy(buf, start, (ndx-start)+1);
add_string_list_ent(stlist, buf);
start = ndx+1;
@@ -512,6 +518,12 @@ expand_acc_string_list(acc_string_list_t **stlist, char *stlist_str)
while(isspace(*start))
start++;
if(((ndx-start)+1) >= 1024)
{
fprintf(stderr, "Fatal str->list too long");
exit(EXIT_FAILURE);
}
strlcpy(buf, start, (ndx-start)+1);
add_string_list_ent(stlist, buf);