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.
9 2 files changed, 7 insertions(+), 2 deletions(-)
11 diff --git a/src/radv.c b/src/radv.c
12 index 749b666..faa0f6d 100644
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);
19 - ra = expand(sizeof(struct ra_packet));
21 + if (!(ra = expand(sizeof(struct ra_packet))))
24 ra->type = ND_ROUTER_ADVERT;
26 diff --git a/src/slaac.c b/src/slaac.c
27 index 8034805..07b8ba4 100644
30 @@ -147,7 +147,10 @@ time_t periodic_slaac(time_t now, struct dhcp_lease *leases)
31 struct sockaddr_in6 addr;
34 - ping = expand(sizeof(struct ping_packet));
36 + if (!(ping = expand(sizeof(struct ping_packet))))
39 ping->type = ICMP6_ECHO_REQUEST;
41 ping->identifier = ping_id;