mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Clone the saved / query message buffers
The message buffer passed to ns__client_request is only valid for the life of the the ns__client_request call. Save a copy of it when we recurse or process a update as ns__client_request will return before those operations complete.
This commit is contained in:
@@ -4749,3 +4749,21 @@ dns_message_setpadding(dns_message_t *msg, uint16_t padding) {
|
||||
}
|
||||
msg->padding = padding;
|
||||
}
|
||||
|
||||
void
|
||||
dns_message_clonebuffer(dns_message_t *msg) {
|
||||
REQUIRE(DNS_MESSAGE_VALID(msg));
|
||||
|
||||
if (msg->free_saved == 0 && msg->saved.base != NULL) {
|
||||
msg->saved.base =
|
||||
memmove(isc_mem_get(msg->mctx, msg->saved.length),
|
||||
msg->saved.base, msg->saved.length);
|
||||
msg->free_saved = 1;
|
||||
}
|
||||
if (msg->free_query == 0 && msg->query.base != NULL) {
|
||||
msg->query.base =
|
||||
memmove(isc_mem_get(msg->mctx, msg->query.length),
|
||||
msg->query.base, msg->query.length);
|
||||
msg->free_query = 1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user