]> 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:02:13 +0000 (16:02 +0100)
src/dhcp.c

index f6b3104e40eea6d02a97221e5c703dd4aaf412ab..0e32665e0fcfbe65b08af3479347bd6cdebb19e8 100644 (file)
@@ -3267,6 +3267,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;
        }
 }