dnsmasq: backport latest patches
[oweals/openwrt.git] / package / network / services / dnsmasq / patches / 0041-Don-t-attempt-to-parse-a-sequence-of-hex-digits-with.patch
1 From 6799320edb9f8465659259721e01e15f9d263aeb Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Mon, 4 Mar 2019 22:59:42 +0000
4 Subject: [PATCH 41/57] Don't attempt to parse a sequence of hex digits without
5  any colons as IPv6 address.
6
7 Another confusion in the heuristic dhcp-option parsing. Sigh.
8
9 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
10 ---
11  src/option.c | 6 +++++-
12  1 file changed, 5 insertions(+), 1 deletion(-)
13
14 --- a/src/option.c
15 +++ b/src/option.c
16 @@ -1181,7 +1181,7 @@ static int parse_dhcp_opt(char *errstr,
17      {
18        /* characterise the value */
19        char c;
20 -      int found_dig = 0;
21 +      int found_dig = 0, found_colon = 0;
22        is_addr = is_addr6 = is_hex = is_dec = is_string = 1;
23        addrs = digs = 1;
24        dots = 0;
25 @@ -1195,6 +1195,7 @@ static int parse_dhcp_opt(char *errstr,
26           {
27             digs++;
28             is_dec = is_addr = 0;
29 +           found_colon = 1;
30           }
31         else if (c == '/') 
32           {
33 @@ -1236,6 +1237,9 @@ static int parse_dhcp_opt(char *errstr,
34       
35        if (!found_dig)
36         is_dec = is_addr = 0;
37 +
38 +      if (!found_colon)
39 +       is_addr6 = 0;
40       
41        /* We know that some options take addresses */
42        if (opt_len & OT_ADDR_LIST)