]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fix: dereferencing a null pointer 530/head
authorShchelkunov Artem <a.shchelkunov@ideco.ru>
Fri, 20 Aug 2021 12:52:14 +0000 (17:52 +0500)
committerShchelkunov Artem <a.shchelkunov@ideco.ru>
Fri, 20 Aug 2021 12:52:18 +0000 (17:52 +0500)
Found by static analyzer svace
Static analyzer message: Return value of a function 'reply_info_copy'
is dereferenced at dns64.c:923 without checking, but it is usually
checked for this function (4/5).

on-behalf-of: @ideco-team <github@ideco.ru>

dns64/dns64.c

index c79bc9c65796ca06377b9f37c7e3360fa379b5ec..8872f10b0f6e2ed5cde552ea4de177ed81b01433 100644 (file)
@@ -913,8 +913,9 @@ dns64_adjust_ptr(struct module_qstate* qstate, struct module_qstate* super)
                     sizeof(struct dns_msg))))
         return;
     super->return_msg->qinfo = super->qinfo;
-    super->return_msg->rep = reply_info_copy(qstate->return_msg->rep, NULL,
-            super->region);
+    if (!(super->return_msg->rep = reply_info_copy(qstate->return_msg->rep,
+                    NULL, super->region)))
+        return;
 
     /*
      * Adjust the domain name of the answer RR set so that it matches the