mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
rndc: sync ISC_R_CANCELED handling in callbacks
rndc_recvdone() is not treating the ISC_R_CANCELED result code as a request to stop data processing, which may cause a crash when trying to dereference ccmsg->buffer. Fix by ensuring ISC_R_CANCELED results in an early exit from rndc_recvdone(). Make sure the logic for handling ISC_R_CANCELED in rndc_recvnonce() matches the one present in rndc_recvdone() to ensure consistent behavior between these two sibling functions.
This commit is contained in:
@@ -316,7 +316,7 @@ static void
|
|||||||
rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
||||||
isccc_ccmsg_t *ccmsg = (isccc_ccmsg_t *)arg;
|
isccc_ccmsg_t *ccmsg = (isccc_ccmsg_t *)arg;
|
||||||
isccc_sexpr_t *response = NULL;
|
isccc_sexpr_t *response = NULL;
|
||||||
isccc_sexpr_t *data;
|
isccc_sexpr_t *data = NULL;
|
||||||
isccc_region_t source;
|
isccc_region_t source;
|
||||||
char *errormsg = NULL;
|
char *errormsg = NULL;
|
||||||
char *textmsg = NULL;
|
char *textmsg = NULL;
|
||||||
@@ -339,7 +339,7 @@ rndc_recvdone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
|||||||
"* the clocks are not synchronized,\n"
|
"* the clocks are not synchronized,\n"
|
||||||
"* the key signing algorithm is incorrect,\n"
|
"* the key signing algorithm is incorrect,\n"
|
||||||
"* or the key is invalid.");
|
"* or the key is invalid.");
|
||||||
} else if (result != ISC_R_SUCCESS && result != ISC_R_CANCELED) {
|
} else if (result != ISC_R_SUCCESS) {
|
||||||
fatal("recv failed: %s", isc_result_totext(result));
|
fatal("recv failed: %s", isc_result_totext(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ rndc_recvnonce(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
|
|||||||
|
|
||||||
REQUIRE(ccmsg != NULL);
|
REQUIRE(ccmsg != NULL);
|
||||||
|
|
||||||
if (shuttingdown && result == ISC_R_EOF) {
|
if (shuttingdown && (result == ISC_R_EOF || result == ISC_R_CANCELED)) {
|
||||||
atomic_fetch_sub_release(&recvs, 1);
|
atomic_fetch_sub_release(&recvs, 1);
|
||||||
if (handle != NULL) {
|
if (handle != NULL) {
|
||||||
REQUIRE(recvnonce_handle == handle);
|
REQUIRE(recvnonce_handle == handle);
|
||||||
|
Reference in New Issue
Block a user