autoupdater: Check if allocation of uci contect was successfull

Previously the return value of uci_alloc_context was not checked leading
to a possible null ptr dereference

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
[Matthias Schiffer: use abort()]
This commit is contained in:
Tobias Schramm 2018-02-20 12:15:42 +01:00 committed by Matthias Schiffer
parent c802276581
commit 0b61fee98e
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 5 additions and 0 deletions

View File

@ -109,6 +109,11 @@ static const char ** load_string_list(struct uci_context *ctx, struct uci_sectio
void load_settings(struct settings *settings) {
struct uci_context *ctx = uci_alloc_context();
if (!ctx) {
fprintf(stderr, "autoupdater: error: failed to allocate UCI context\n");
abort();
}
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;