]> 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)
committerArаm Sаrgsyаn <aram@isc.org>
Mon, 3 Apr 2023 15:21:43 +0000 (15:21 +0000)
The 'request' pointer is used before it is checked. Perform the check
before using the pointer.

lib/dns/request.c

index 977b2ebaad59c623fd577613c7ac0a10df44c59d..5cb7c7d263af031a64a24bac2360b81d232e0128 100644 (file)
@@ -972,6 +972,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) {
@@ -989,8 +991,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) {