File: eac7152ec04f5a330f01ab9504514a03f873b35c.patch

package info (click to toggle)
dhcpcd 1%3A10.1.0-11%2Bdeb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,412 kB
  • sloc: ansic: 39,223; sh: 2,353; makefile: 376
file content (33 lines) | stat: -rw-r--r-- 985 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From eac7152ec04f5a330f01ab9504514a03f873b35c Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Wed, 5 Feb 2025 18:06:01 +0000
Subject: [PATCH] DHCP: Fix crash when someone deletes our address

Fixes #455
---
 src/ipv4.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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);