From 6ac122670a3dc4102e4993db2d668169183a7f32 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 7 Aug 2018 11:08:09 +0100 Subject: [PATCH] [Fix] Allow to add result-less fake DNS records --- contrib/librdns/resolver.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c index 2ce85b2c5..3abb17304 100644 --- a/contrib/librdns/resolver.c +++ b/contrib/librdns/resolver.c @@ -982,7 +982,10 @@ void rdns_resolver_set_fake_reply (struct rdns_resolver *resolver, if (fake_rep) { /* Append reply to the existing list */ fake_rep->rcode = rcode; - DL_APPEND (fake_rep->result, reply); + + if (reply) { + DL_APPEND (fake_rep->result, reply); + } } else { fake_rep = calloc (1, sizeof (*fake_rep) + len); @@ -992,7 +995,11 @@ void rdns_resolver_set_fake_reply (struct rdns_resolver *resolver, } memcpy (&fake_rep->key, srch, sizeof (*srch) + len); - DL_APPEND (fake_rep->result, reply); + + if (reply) { + DL_APPEND (fake_rep->result, reply); + } + HASH_ADD (hh, resolver->fake_elts, key, sizeof (*srch) + len, fake_rep); } } \ No newline at end of file -- 2.39.5