Increase the realloc increment from 128 to 1024.
The contents of the env_add array should not include the leading "env=" prefix.
This commit is contained in:
@@ -118,13 +118,13 @@ push(struct dynamic_array *arr, const char *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arr->len + (entry != NULL) >= arr->size) {
|
if (arr->len + (entry != NULL) >= arr->size) {
|
||||||
char **tmp = reallocarray(arr->entries, arr->size + 128, sizeof(char *));
|
char **tmp = reallocarray(arr->entries, arr->size + 1024, sizeof(char *));
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
free(copy);
|
free(copy);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
arr->entries = tmp;
|
arr->entries = tmp;
|
||||||
arr->size += 128;
|
arr->size += 1024;
|
||||||
}
|
}
|
||||||
if (copy != NULL)
|
if (copy != NULL)
|
||||||
arr->entries[arr->len++] = copy;
|
arr->entries[arr->len++] = copy;
|
||||||
@@ -372,7 +372,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
/* Additional environment variables to add. */
|
/* Additional environment variables to add. */
|
||||||
if (strncmp(line, "env=", sizeof("env=") - 1) == 0) {
|
if (strncmp(line, "env=", sizeof("env=") - 1) == 0) {
|
||||||
push(&env_add, line);
|
const char *cp = line + sizeof("env=") - 1;
|
||||||
|
if (strchr(cp, '=') != NULL)
|
||||||
|
push(&env_add, line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user