]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix a potential crash where the DHCP state could be freed during processing.
authorRoy Marples <roy@marples.name>
Mon, 27 Mar 2017 15:01:52 +0000 (16:01 +0100)
committerRoy Marples <roy@marples.name>
Mon, 27 Mar 2017 15:43:26 +0000 (16:43 +0100)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index aa19b0824a96a0578fc849bc6254b658c1710a33..9f0190832c3cee8ca20b016aaa6a8016c37eaaa2 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -3223,6 +3223,9 @@ dhcp_readpacket(void *arg)
                        return;
                }
                dhcp_handlepacket(ifp, buf, (size_t)bytes, flags);
+               /* Check we still have a state after processing. */
+               if ((state = D_CSTATE(ifp)) == NULL || state->bpf_fd == -1)
+                       break;
        }
 }