From: Aram Sargsyan Date: Mon, 12 Dec 2022 12:08:16 +0000 (+0000) Subject: Perform request validation in req_response() before using the pointer X-Git-Tag: v9.19.12~25^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5b373596975862b4f6df2f70516db02683a9e7fc;p=thirdparty%2Fbind9.git Perform request validation in req_response() before using the pointer The 'request' pointer is used before it is checked. Perform the check before using the pointer. --- diff --git a/lib/dns/request.c b/lib/dns/request.c index 977b2ebaad5..5cb7c7d263a 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -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) {