]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/dnsmasq/003-Check_return_of_expand_always.patch
unbound: Rewrite configuration and initscript
[people/pmueller/ipfire-2.x.git] / src / patches / dnsmasq / 003-Check_return_of_expand_always.patch
1 From ce7845bf5429bd2962c9b2e7d75e2659f3b5c1a8 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Wed, 6 Jul 2016 21:42:27 +0100
4 Subject: [PATCH] Check return of expand() always.
5
6 ---
7 src/radv.c | 4 +++-
8 src/slaac.c | 5 ++++-
9 2 files changed, 7 insertions(+), 2 deletions(-)
10
11 diff --git a/src/radv.c b/src/radv.c
12 index 749b666..faa0f6d 100644
13 --- a/src/radv.c
14 +++ b/src/radv.c
15 @@ -262,7 +262,9 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad
16 parm.prio = calc_prio(ra_param);
17
18 save_counter(0);
19 - ra = expand(sizeof(struct ra_packet));
20 +
21 + if (!(ra = expand(sizeof(struct ra_packet))))
22 + return;
23
24 ra->type = ND_ROUTER_ADVERT;
25 ra->code = 0;
26 diff --git a/src/slaac.c b/src/slaac.c
27 index 8034805..07b8ba4 100644
28 --- a/src/slaac.c
29 +++ b/src/slaac.c
30 @@ -147,7 +147,10 @@ time_t periodic_slaac(time_t now, struct dhcp_lease *leases)
31 struct sockaddr_in6 addr;
32
33 save_counter(0);
34 - ping = expand(sizeof(struct ping_packet));
35 +
36 + if (!(ping = expand(sizeof(struct ping_packet))))
37 + continue;
38 +
39 ping->type = ICMP6_ECHO_REQUEST;
40 ping->code = 0;
41 ping->identifier = ping_id;
42 --
43 1.7.10.4
44