autoupdater: Replace malloc by safe_malloc
During argument parsing the allocation of the string array for the mirror list had no NULL check leading to a possible null ptr dereference Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
This commit is contained in:
parent
a6336d0bce
commit
5f65095e47
|
@ -144,7 +144,8 @@ static void parse_args(int argc, char *argv[], struct settings *settings) {
|
|||
|
||||
if (optind < argc) {
|
||||
settings->n_mirrors = argc - optind;
|
||||
settings->mirrors = malloc(settings->n_mirrors * sizeof(char *));
|
||||
settings->mirrors = safe_malloc(settings->n_mirrors * sizeof(char *), "failed to allocate memory for mirror list");
|
||||
|
||||
for (int i = optind; i < argc; i++) {
|
||||
settings->mirrors[i - optind] = argv[i];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue