Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / dnsmasq / dnsmasq / stx / dnsmasq-2.76-CVE-2017-14491-2.patch
1 From 62cb936cb7ad5f219715515ae7d32dd281a5aa1f Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Tue, 26 Sep 2017 22:00:11 +0100
4 Subject: Security fix, CVE-2017-14491, DNS heap buffer overflow.
5
6 Further fix to 0549c73b7ea6b22a3c49beb4d432f185a81efcbc
7 Handles case when RR name is not a pointer to the question,
8 only occurs for some auth-mode replies, therefore not
9 detected by fuzzing (?)
10 ---
11  src/rfc1035.c | 27 +++++++++++++++------------
12  1 file changed, 15 insertions(+), 12 deletions(-)
13
14 diff --git a/src/rfc1035.c b/src/rfc1035.c
15 index 27af023..56ab88b 100644
16 --- a/src/rfc1035.c
17 +++ b/src/rfc1035.c
18 @@ -1086,32 +1086,35 @@ int add_resource_record(struct dns_header *header, char *limit, int *truncp, int
19  
20    va_start(ap, format);   /* make ap point to 1st unamed argument */
21  
22 -  /* nameoffset (1 or 2) + type (2) + class (2) + ttl (4) + 0 (2) */
23 -  CHECK_LIMIT(12);
24 -
25    if (nameoffset > 0)
26      {
27 +      CHECK_LIMIT(2);
28        PUTSHORT(nameoffset | 0xc000, p);
29      }
30    else
31      {
32        char *name = va_arg(ap, char *);
33 -      if (name)
34 -       p = do_rfc1035_name(p, name, limit);
35 -        if (!p)
36 -          {
37 -            va_end(ap);
38 -            goto truncated;
39 -          }
40 -
41 +      if (name && !(p = do_rfc1035_name(p, name, limit)))
42 +       {
43 +         va_end(ap);
44 +         goto truncated;
45 +       }
46 +      
47        if (nameoffset < 0)
48         {
49 +         CHECK_LIMIT(2);
50           PUTSHORT(-nameoffset | 0xc000, p);
51         }
52        else
53 -       *p++ = 0;
54 +       {
55 +         CHECK_LIMIT(1);
56 +         *p++ = 0;
57 +       }
58      }
59  
60 +  /* type (2) + class (2) + ttl (4) + rdlen (2) */
61 +  CHECK_LIMIT(10);
62 +  
63    PUTSHORT(type, p);
64    PUTSHORT(class, p);
65    PUTLONG(ttl, p);      /* TTL */
66 -- 
67 2.7.4
68