Merge branch '2917-preserve-the-contents-of-tcp-buffer' into 'main'

Preserve the contents of socket buffer on realloc

Closes #2917

See merge request isc-projects/bind9!5437
This commit is contained in:
Ondřej Surý
2021-09-23 21:21:38 +00:00
3 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
5722. [bug] Preserve the contents of TCPDNS and TLSDNS receive
buffer when growing the buffer size. [GL #2917]
5721. [func] New isc_mem_reget() realloc-like function was
introduced into the libisc API, and zero-sized
allocations now return non-NULL pointers. [GL !5440]

View File

@@ -62,3 +62,6 @@ Bug Fixes
- When new IP addresses were added to the system during ``named``
startup, ``named`` failed to listen on TCP for the newly added
interfaces. :gl:`#2852`
- Under specific circumstances, zone transfers over TCP and TLS could be
interrupted prematurely. This has been fixed. :gl:`#2917`

View File

@@ -1894,8 +1894,8 @@ isc__nm_alloc_dnsbuf(isc_nmsocket_t *sock, size_t len) {
sock->buf_size = alloc_len;
} else {
/* We have the buffer but it's too small */
isc_mem_put(sock->mgr->mctx, sock->buf, sock->buf_size);
sock->buf = isc_mem_get(sock->mgr->mctx, NM_BIG_BUF);
sock->buf = isc_mem_reget(sock->mgr->mctx, sock->buf,
sock->buf_size, NM_BIG_BUF);
sock->buf_size = NM_BIG_BUF;
}
}