]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Do not crash on dhcpcd test run (#231)
authorPetr Menšík <pemensik@redhat.com>
Fri, 4 Aug 2023 16:45:25 +0000 (18:45 +0200)
committerRoy Marples <roy@marples.name>
Wed, 23 Aug 2023 09:12:49 +0000 (10:12 +0100)
Check if state->bpf is allocated before attempting to write there.

src/dhcp.c

index c7154634146b4e9a26ece0e01b789a715bd44ede..f768076059b2e2a5641ae0b81991452505bb52f2 100644 (file)
@@ -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);