This defect was found by the coccinelle script "unchecked-strdup.cocci". It can be backported to all supported branches. --- src/resolvers.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/src/resolvers.c b/src/resolvers.c index f8f0c8edf..bff5c290d 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -3496,6 +3496,10 @@ static int resolvers_new(struct resolvers **resolvers, const char *id, const cha resolvers_setup_proxy(p); p->parent = r; p->id = strdup(id); + if (!p->id) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } p->conf.args.file = p->conf.file = copy_file_name(file); p->conf.args.line = p->conf.line = linenum; r->px = p; @@ -3503,8 +3507,16 @@ static int resolvers_new(struct resolvers **resolvers, const char *id, const cha /* default values */ LIST_APPEND(&sec_resolvers, &r->list); r->conf.file = strdup(file); + if (!r->conf.file) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } r->conf.line = linenum; r->id = strdup(id); + if (!r->id) { + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } r->query_ids = EB_ROOT; /* default maximum response size */ r->accepted_payload_size = 512; -- 2.47.0