From 42a38785f1d229483c68ac22e1707be57e8fe60e Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 13 Jun 2019 21:59:31 +0200 Subject: [PATCH] interface-ip: fix possible null pointer dereference Reported by Coverity in CID 1445749 Signed-off-by: Hans Dedecker --- interface-ip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface-ip.c b/interface-ip.c index 864de50..c159e09 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -353,11 +353,11 @@ interface_ip_add_neighbor(struct interface *iface, struct blob_attr *attr, bool ip = &iface->proto_ip; neighbor = calloc(1,sizeof(*neighbor)); - neighbor->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4; - if (!neighbor) return; + neighbor->flags = v6 ? DEVADDR_INET6 : DEVADDR_INET4; + if ((cur = tb[NEIGHBOR_ADDRESS]) != NULL){ if (!inet_pton(af, blobmsg_data(cur), &neighbor->addr)) goto error; -- 2.30.2