aboutsummaryrefslogtreecommitdiffstats
path: root/main/dnsmasq/CVE-2017-14493.patch
blob: 20b178245c5b2f9648e4dc83a562ed2af46c2fbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 3d4ff1ba8419546490b464418223132529514033 Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Mon, 25 Sep 2017 18:52:50 +0100
Subject: [PATCH] Security fix, CVE-2017-14493, DHCPv6 - Stack buffer
 overflow.

Fix stack overflow in DHCPv6 code. An attacker who can send
a DHCPv6 request to dnsmasq can overflow the stack frame and
crash or control dnsmasq.
---
 src/rfc3315.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/rfc3315.c b/src/rfc3315.c
index 1687931..920907c 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -206,6 +206,9 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
   /* RFC-6939 */
   if ((opt = opt6_find(opts, end, OPTION6_CLIENT_MAC, 3)))
     {
+      if (opt6_len(opt) - 2 > DHCP_CHADDR_MAX) {
+        return 0;
+      }
       state->mac_type = opt6_uint(opt, 0, 2);
       state->mac_len = opt6_len(opt) - 2;
       memcpy(&state->mac[0], opt6_ptr(opt, 2), state->mac_len);
-- 
2.9.5