e87dd3
From c14b8b511ac55f6933aebefbd6cc27c1ec74ad58 Mon Sep 17 00:00:00 2001
e87dd3
From: Simon Kelley <simon@thekelleys.org.uk>
e87dd3
Date: Mon, 25 Sep 2017 18:47:15 +0100
e87dd3
Subject: [PATCH 2/9]     Security fix, CVE-2017-14492, DHCPv6 RA heap
e87dd3
 overflow.
e87dd3
e87dd3
    Fix heap overflow in IPv6 router advertisement code.
e87dd3
    This is a potentially serious security hole, as a
e87dd3
    crafted RA request can overflow a buffer and crash or
e87dd3
    control dnsmasq. Attacker must be on the local network.
e87dd3
---
e87dd3
 src/radv.c | 3 +++
e87dd3
 1 file changed, 3 insertions(+)
e87dd3
e87dd3
diff --git a/src/radv.c b/src/radv.c
e87dd3
index 749b666..d09fe0e 100644
e87dd3
--- a/src/radv.c
e87dd3
+++ b/src/radv.c
e87dd3
@@ -198,6 +198,9 @@ void icmp6_packet(time_t now)
e87dd3
       /* look for link-layer address option for logging */
e87dd3
       if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz)
e87dd3
 	{
e87dd3
+	  if ((packet[9] * 8 - 2) * 3 - 1 >= MAXDNAME) {
e87dd3
+	    return;
e87dd3
+	  }
e87dd3
 	  print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2);
e87dd3
 	  mac = daemon->namebuff;
e87dd3
 	}
e87dd3
-- 
e87dd3
2.9.5
e87dd3