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