|
|
5fe83d |
From c5a9fd85a19a63f88a5f17c7e6d074ee22364093 Mon Sep 17 00:00:00 2001
|
|
|
5fe83d |
From: Petr Mensik <pemensik@redhat.com>
|
|
|
5fe83d |
Date: Tue, 18 Aug 2020 10:53:33 +0200
|
|
|
5fe83d |
Subject: [PATCH] Fix CVE-2020-8622
|
|
|
5fe83d |
|
|
|
5fe83d |
5476. [security] It was possible to trigger an assertion failure when
|
|
|
5fe83d |
verifying the response to a TSIG-signed request.
|
|
|
5fe83d |
(CVE-2020-8622) [GL #2028]
|
|
|
5fe83d |
---
|
|
|
5fe83d |
lib/dns/message.c | 24 +++++++++++++-----------
|
|
|
5fe83d |
1 file changed, 13 insertions(+), 11 deletions(-)
|
|
|
5fe83d |
|
|
|
5fe83d |
diff --git a/lib/dns/message.c b/lib/dns/message.c
|
|
|
5fe83d |
index d9e341a..7c813a5 100644
|
|
|
5fe83d |
--- a/lib/dns/message.c
|
|
|
5fe83d |
+++ b/lib/dns/message.c
|
|
|
5fe83d |
@@ -1712,6 +1712,19 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
|
|
|
5fe83d |
msg->header_ok = 0;
|
|
|
5fe83d |
msg->question_ok = 0;
|
|
|
5fe83d |
|
|
|
5fe83d |
+ if ((options & DNS_MESSAGEPARSE_CLONEBUFFER) == 0) {
|
|
|
5fe83d |
+ isc_buffer_usedregion(&origsource, &msg->saved);
|
|
|
5fe83d |
+ } else {
|
|
|
5fe83d |
+ msg->saved.length = isc_buffer_usedlength(&origsource);
|
|
|
5fe83d |
+ msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length);
|
|
|
5fe83d |
+ if (msg->saved.base == NULL) {
|
|
|
5fe83d |
+ return (ISC_R_NOMEMORY);
|
|
|
5fe83d |
+ }
|
|
|
5fe83d |
+ memmove(msg->saved.base, isc_buffer_base(&origsource),
|
|
|
5fe83d |
+ msg->saved.length);
|
|
|
5fe83d |
+ msg->free_saved = 1;
|
|
|
5fe83d |
+ }
|
|
|
5fe83d |
+
|
|
|
5fe83d |
isc_buffer_remainingregion(source, &r);
|
|
|
5fe83d |
if (r.length < DNS_MESSAGE_HEADERLEN)
|
|
|
5fe83d |
return (ISC_R_UNEXPECTEDEND);
|
|
|
5fe83d |
@@ -1787,17 +1800,6 @@ dns_message_parse(dns_message_t *msg, isc_buffer_t *source,
|
|
|
5fe83d |
}
|
|
|
5fe83d |
|
|
|
5fe83d |
truncated:
|
|
|
5fe83d |
- if ((options & DNS_MESSAGEPARSE_CLONEBUFFER) == 0)
|
|
|
5fe83d |
- isc_buffer_usedregion(&origsource, &msg->saved);
|
|
|
5fe83d |
- else {
|
|
|
5fe83d |
- msg->saved.length = isc_buffer_usedlength(&origsource);
|
|
|
5fe83d |
- msg->saved.base = isc_mem_get(msg->mctx, msg->saved.length);
|
|
|
5fe83d |
- if (msg->saved.base == NULL)
|
|
|
5fe83d |
- return (ISC_R_NOMEMORY);
|
|
|
5fe83d |
- memmove(msg->saved.base, isc_buffer_base(&origsource),
|
|
|
5fe83d |
- msg->saved.length);
|
|
|
5fe83d |
- msg->free_saved = 1;
|
|
|
5fe83d |
- }
|
|
|
5fe83d |
|
|
|
5fe83d |
if (ret == ISC_R_UNEXPECTEDEND && ignore_tc)
|
|
|
5fe83d |
return (DNS_R_RECOVERABLE);
|
|
|
5fe83d |
--
|
|
|
5fe83d |
2.26.2
|
|
|
5fe83d |
|