From a6336d0bce39e01bcd44a194ed557a6ca167be03 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Tue, 20 Feb 2018 12:15:42 +0100 Subject: [PATCH] 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 --- admin/autoupdater/src/settings.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/autoupdater/src/settings.c b/admin/autoupdater/src/settings.c index 50a7afb..47cc8f6 100644 --- a/admin/autoupdater/src/settings.c +++ b/admin/autoupdater/src/settings.c @@ -110,6 +110,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"); + exit(1); + } + ctx->flags &= ~UCI_FLAG_STRICT; struct uci_package *p;