In build_volume(), check if arrays is allocated before traversing its
items. While parsing the arrays input, it's possible that we reach the error path before initializing the 'arrays' pointer, which in turn leads to a NULL deference. Submitted by: Garrett Cooper MFC after: 1 week
This commit is contained in:
parent
17c43cd83a
commit
6dc3afae75
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228119
@ -820,9 +820,11 @@ create_volume(int ac, char **av)
|
||||
free(config);
|
||||
free(state.volumes);
|
||||
free(state.arrays);
|
||||
for (i = 0; i < narrays; i++)
|
||||
free(arrays[i].drives);
|
||||
free(arrays);
|
||||
if (arrays != NULL) {
|
||||
for (i = 0; i < narrays; i++)
|
||||
free(arrays[i].drives);
|
||||
free(arrays);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user