]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Allow to add result-less fake DNS records
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Aug 2018 10:08:09 +0000 (11:08 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Aug 2018 10:08:09 +0000 (11:08 +0100)
contrib/librdns/resolver.c

index 2ce85b2c58e78d7d08d4fe7194808c3ba9e5abf5..3abb17304fa9facaa6a6d7bbde3bb1c71013151a 100644 (file)
@@ -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