From: Petr Menšík Date: Fri, 4 Aug 2023 16:45:25 +0000 (+0200) Subject: Do not crash on dhcpcd test run (#231) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8ee2f024644daf7920614158fcb80e3db6ab774;p=thirdparty%2Fdhcpcd.git Do not crash on dhcpcd test run (#231) Check if state->bpf is allocated before attempting to write there. --- diff --git a/src/dhcp.c b/src/dhcp.c index c7154634..f7680760 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -3336,7 +3336,8 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len, state->reason = "TEST"; script_runreason(ifp, state->reason); eloop_exit(ifp->ctx->eloop, EXIT_SUCCESS); - state->bpf->bpf_flags |= BPF_EOF; + if (state->bpf) + state->bpf->bpf_flags |= BPF_EOF; return; } eloop_timeout_delete(ifp->ctx->eloop, send_discover, ifp);