From: Hans Dedecker Date: Thu, 13 Jun 2019 19:59:31 +0000 (+0200) Subject: interface-ip: fix possible null pointer dereference X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=42a38785f1d229483c68ac22e1707be57e8fe60e;p=oweals%2Fnetifd.git interface-ip: fix possible null pointer dereference Reported by Coverity in CID 1445749 Signed-off-by: Hans Dedecker --- 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;