2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Merge branch 'artem-fix-xot-crash-on-unexpected-incoming-message' into 'main'

Fix a crash on unexpected incoming DNS message during XoT xfer

Closes #3004

See merge request isc-projects/bind9!5567
This commit is contained in:
Artem Boldariev
2021-11-24 09:40:15 +00:00
3 changed files with 35 additions and 2 deletions

View File

@@ -1,3 +1,7 @@
5763. [bug] Fix a bug in DoT code leading to an abort when
a zone transfer ends with an unexpected DNS message.
[GL #3004]
5762. [bug] Fix a "named" crash related to removing and restoring a
`catalog-zone` entry in the configuration file and
running `rndc reconfig`. [GL #1608]

View File

@@ -774,6 +774,23 @@ isc__nm_tcpdns_processbuffer(isc_nmsocket_t *sock) {
return (ISC_R_NOMORE);
}
if (sock->recv_cb == NULL) {
/*
* recv_cb has been cleared - there is
* nothing to do
*/
return (ISC_R_CANCELED);
} else if (sock->statichandle == NULL &&
atomic_load(&sock->connected) &&
!atomic_load(&sock->connecting))
{
/*
* It seems that some unexpected data (a DNS message) has
* arrived while we are wrapping up.
*/
return (ISC_R_CANCELED);
}
req = isc__nm_get_read_req(sock, NULL);
REQUIRE(VALID_UVREQ(req));

View File

@@ -937,8 +937,20 @@ isc__nm_tlsdns_processbuffer(isc_nmsocket_t *sock) {
}
if (sock->recv_cb == NULL) {
/* recv_cb has been cleared - there is
* nothing to do */
/*
* recv_cb has been cleared - there is
* nothing to do
*/
return (ISC_R_CANCELED);
} else if (sock->statichandle == NULL &&
sock->tls.state == TLS_STATE_IO &&
atomic_load(&sock->connected) &&
!atomic_load(&sock->connecting))
{
/*
* It seems that some unexpected data (a DNS message) has
* arrived while we are wrapping up.
*/
return (ISC_R_CANCELED);
}