]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Perform request validation in req_response() before using the pointer
authorAram Sargsyan <aram@isc.org>
Mon, 12 Dec 2022 12:08:16 +0000 (12:08 +0000)
committerAram Sargsyan <aram@isc.org>
Mon, 3 Apr 2023 16:18:39 +0000 (16:18 +0000)
The 'request' pointer is used before it is checked. Perform the check
before using the pointer.

(cherry picked from commit 5b373596975862b4f6df2f70516db02683a9e7fc)

lib/dns/request.c

index 1103bea49ff255c9e891c77c1734af29ccf74be9..8f53d3781266d32463ae2ac3159f9fe145d1b0d7 100644 (file)
@@ -1057,6 +1057,8 @@ req_response(isc_result_t result, isc_region_t *region, void *arg) {
        req_log(ISC_LOG_DEBUG(3), "req_response: request %p: %s", request,
                isc_result_totext(result));
 
+       REQUIRE(VALID_REQUEST(request));
+
        if (result == ISC_R_TIMEDOUT) {
                LOCK(&request->requestmgr->locks[request->hash]);
                if (request->udpcount > 1) {
@@ -1074,8 +1076,6 @@ req_response(isc_result_t result, isc_region_t *region, void *arg) {
                goto done;
        }
 
-       REQUIRE(VALID_REQUEST(request));
-
        LOCK(&request->requestmgr->locks[request->hash]);
 
        if (result != ISC_R_SUCCESS) {