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-Tag: v10.0.3~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7b7b656f85ff2132c6214edf5d93173a3df1b10;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 edd1c011..e029cee3 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -3314,7 +3314,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);