mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Fix UAF in ccmsg.c when reading stopped before sending
When shutting down the whole server, the reading could stop and detach from controlconnection before sending is done. If send callback then detaches from the last controlconnection handle, the ccmsg would be invalidated after the send callback and thus we must not access ccmsg after calling the send_cb().
This commit is contained in:
@@ -150,11 +150,13 @@ ccmsg_senddone(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
isccc_ccmsg_t *ccmsg = arg;
|
||||
|
||||
REQUIRE(VALID_CCMSG(ccmsg));
|
||||
REQUIRE(ccmsg->send_cb != NULL);
|
||||
|
||||
INSIST(ccmsg->send_cb != NULL);
|
||||
ccmsg->send_cb(handle, eresult, ccmsg->send_cbarg);
|
||||
isc_nm_cb_t send_cb = ccmsg->send_cb;
|
||||
ccmsg->send_cb = NULL;
|
||||
|
||||
send_cb(handle, eresult, ccmsg->send_cbarg);
|
||||
|
||||
isc_nmhandle_detach(&handle);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user