From: Roy Marples Date: Wed, 5 Feb 2025 18:06:01 +0000 (+0000) Subject: DHCP: Fix crash when someone deletes our address X-Git-Tag: v10.2.0~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eac7152ec04f5a330f01ab9504514a03f873b35c;p=thirdparty%2Fdhcpcd.git DHCP: Fix crash when someone deletes our address Fixes #455 --- diff --git a/src/ipv4.c b/src/ipv4.c index a5fe4900..ce67bfec 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -524,6 +524,7 @@ ipv4_deladdr(struct ipv4_addr *addr, int keeparp) struct ipv4_state *state; struct ipv4_addr *ap; + assert(addr != NULL); logdebugx("%s: deleting IP address %s", addr->iface->name, addr->saddr); @@ -760,7 +761,9 @@ ipv4_applyaddr(void *arg) (DHCPCD_EXITING | DHCPCD_PERSISTENT)) { if (state->added) { - ipv4_deladdr(state->addr, 0); + /* Someone might have deleted our address */ + if (state->addr != NULL) + ipv4_deladdr(state->addr, 0); rt_build(ifp->ctx, AF_INET); } script_runreason(ifp, state->reason);