summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-03-27 16:01:52 +0100
committerRoy Marples <roy@marples.name>2017-03-27 16:43:26 +0100
commit229e6ce549bfc738c7d09a98dc3dc77a716dc18e (patch)
tree4aa99dd2db5f4849e09e8fad32ec331e1b0a6b79
parenta017eae146151a5ffeefe23757a1bc703ddbfdcc (diff)
downloaddhcpcd-229e6ce549bfc738c7d09a98dc3dc77a716dc18e.tar.xz
Fix a potential crash where the DHCP state could be freed during processing.
-rw-r--r--dhcp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/dhcp.c b/dhcp.c
index aa19b082..9f019083 100644
--- 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;
}
}