From 603800151415c69ceb3c9d986ef0c3487817cb67 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Thu, 25 Oct 2018 05:11:32 +0500 Subject: fix gateway address setup fail due memory corruption log: libnetlink: RTNETLINK answers: Invalid argument ppp0: f7bb00a79ef667d2: failed to set IPv4 address: Invalid argument ipaddr_add_peer() called only with mask equeal 0 or 32, but w/o zero-allocated structs it contans garbage in some cases. so, instead ipaddr_add() was called with wrong mask value. also, init chap-secrets mask for the same reason. --- accel-pppd/extra/ipv6pool.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'accel-pppd/extra/ipv6pool.c') diff --git a/accel-pppd/extra/ipv6pool.c b/accel-pppd/extra/ipv6pool.c index 6fa5cc53..4f29a280 100644 --- a/accel-pppd/extra/ipv6pool.c +++ b/accel-pppd/extra/ipv6pool.c @@ -83,6 +83,7 @@ static void generate_ippool(struct in6_addr *addr, int mask, int prefix_len) while (in6_addr_cmp(&ip, &end) <= 0) { it = malloc(sizeof(*it)); + memset(it, 0, sizeof(*it)); it->it.owner = &ipdb; INIT_LIST_HEAD(&it->it.addr_list); a = malloc(sizeof(*a)); @@ -119,6 +120,7 @@ static void generate_dppool(struct in6_addr *addr, int mask, int prefix_len) while (in6_addr_cmp(&ip, &end) <= 0) { it = malloc(sizeof(*it)); + memset(it, 0, sizeof(*it)); it->it.owner = &ipdb; INIT_LIST_HEAD(&it->it.prefix_list); a = malloc(sizeof(*a)); -- cgit v1.2.3