2021-09-09 07:59:26 +00:00
|
|
|
From 77c7cabbeab1fbe1f7296f33762771f208586e59 Mon Sep 17 00:00:00 2001
|
2017-10-03 11:53:42 +00:00
|
|
|
From: Doran Moppert <dmoppert@redhat.com>
|
|
|
|
Date: Tue, 26 Sep 2017 14:48:20 +0930
|
|
|
|
Subject: [PATCH] google patch hand-applied
|
|
|
|
|
|
|
|
---
|
|
|
|
src/edns0.c | 10 +++++-----
|
|
|
|
src/forward.c | 4 ++++
|
2020-03-03 19:15:05 +00:00
|
|
|
src/rfc1035.c | 3 +++
|
|
|
|
3 files changed, 12 insertions(+), 5 deletions(-)
|
2017-10-03 11:53:42 +00:00
|
|
|
|
|
|
|
diff --git a/src/edns0.c b/src/edns0.c
|
2021-09-09 07:59:26 +00:00
|
|
|
index 7bd26b8..7f96414 100644
|
2017-10-03 11:53:42 +00:00
|
|
|
--- a/src/edns0.c
|
|
|
|
+++ b/src/edns0.c
|
|
|
|
@@ -212,11 +212,11 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l
|
|
|
|
/* Copy back any options */
|
|
|
|
if (buff)
|
|
|
|
{
|
|
|
|
- if (p + rdlen > limit)
|
|
|
|
- {
|
|
|
|
- free(buff);
|
|
|
|
- return plen; /* Too big */
|
|
|
|
- }
|
|
|
|
+ if (p + rdlen > limit)
|
|
|
|
+ {
|
|
|
|
+ free(buff);
|
|
|
|
+ return plen; /* Too big */
|
|
|
|
+ }
|
|
|
|
memcpy(p, buff, rdlen);
|
|
|
|
free(buff);
|
|
|
|
p += rdlen;
|
|
|
|
diff --git a/src/forward.c b/src/forward.c
|
2021-09-09 07:59:26 +00:00
|
|
|
index 3d638e4..e254e35 100644
|
2017-10-03 11:53:42 +00:00
|
|
|
--- a/src/forward.c
|
|
|
|
+++ b/src/forward.c
|
2021-09-09 07:59:26 +00:00
|
|
|
@@ -1558,6 +1558,10 @@ void receive_query(struct listener *listen, time_t now)
|
2017-10-03 11:53:42 +00:00
|
|
|
udp_size = PACKETSZ; /* Sanity check - can't reduce below default. RFC 6891 6.2.3 */
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Make sure the udp size is not smaller than the incoming message so that we
|
|
|
|
+ // do not underflow
|
|
|
|
+ if (udp_size < n) udp_size = n;
|
|
|
|
+
|
2021-09-09 07:59:26 +00:00
|
|
|
#ifdef HAVE_CONNTRACK
|
2017-10-03 11:53:42 +00:00
|
|
|
#ifdef HAVE_AUTH
|
2021-09-09 07:59:26 +00:00
|
|
|
if (!auth_dns || local_auth)
|
2017-10-03 11:53:42 +00:00
|
|
|
diff --git a/src/rfc1035.c b/src/rfc1035.c
|
2021-09-09 07:59:26 +00:00
|
|
|
index 6fc4f26..66fa00c 100644
|
2017-10-03 11:53:42 +00:00
|
|
|
--- a/src/rfc1035.c
|
|
|
|
+++ b/src/rfc1035.c
|
2021-09-09 07:59:26 +00:00
|
|
|
@@ -1396,6 +1396,9 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
2017-10-03 11:53:42 +00:00
|
|
|
size_t len;
|
2020-03-03 19:15:05 +00:00
|
|
|
int rd_bit = (header->hb3 & HB3_RD);
|
|
|
|
|
2017-10-03 11:53:42 +00:00
|
|
|
+ // Make sure we do not underflow here too.
|
|
|
|
+ if (qlen > (limit - ((char *)header))) return 0;
|
2020-03-03 19:15:05 +00:00
|
|
|
+
|
2018-10-24 17:26:46 +00:00
|
|
|
/* never answer queries with RD unset, to avoid cache snooping. */
|
2020-03-03 19:15:05 +00:00
|
|
|
if (ntohs(header->ancount) != 0 ||
|
|
|
|
ntohs(header->nscount) != 0 ||
|
2017-10-03 11:53:42 +00:00
|
|
|
--
|
2021-09-09 07:59:26 +00:00
|
|
|
2.31.1
|
2017-10-03 11:53:42 +00:00
|
|
|
|