From 5c6cf3e627b95a76ccdd21b956a9e77f05f250d9 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Sat, 20 Mar 2021 18:25:15 +0500 Subject: ipv6, shaper: fix possible NULL-pointer dereference --- accel-pppd/ipv6/dhcpv6.c | 3 +++ accel-pppd/ipv6/nd.c | 6 +++++- accel-pppd/shaper/shaper.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c index a48d7a1d..471e0a0a 100644 --- a/accel-pppd/ipv6/dhcpv6.c +++ b/accel-pppd/ipv6/dhcpv6.c @@ -826,6 +826,9 @@ static void add_dnssl(const char *val) const char *ptr; uint8_t *buf; + if (!val) + return; + if (val[n - 1] == '.') n++; else diff --git a/accel-pppd/ipv6/nd.c b/accel-pppd/ipv6/nd.c index 4dd9d5a7..a4233b52 100644 --- a/accel-pppd/ipv6/nd.c +++ b/accel-pppd/ipv6/nd.c @@ -414,6 +414,9 @@ static void add_dnssl(const char *val) const char *ptr; uint8_t *buf; + if (!val) + return; + if (val[n - 1] == '.') n++; else @@ -474,7 +477,8 @@ static void load_dns(void) } if (!strcmp(opt->name, "lifetime")) { - conf_rdnss_lifetime = atoi(opt->val); + if (opt->val) + conf_rdnss_lifetime = atoi(opt->val); continue; } diff --git a/accel-pppd/shaper/shaper.c b/accel-pppd/shaper/shaper.c index 351a7ee1..69555318 100644 --- a/accel-pppd/shaper/shaper.c +++ b/accel-pppd/shaper/shaper.c @@ -903,6 +903,9 @@ static struct time_range_t *parse_range(time_t t, const char *val) struct tm begin_tm, end_tm; struct time_range_t *r; + if (!val) + return NULL; + id = strtol(val, &endptr, 10); if (*endptr != ',') return NULL; -- cgit v1.2.3