]> 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)
committerGitHub <noreply@github.com>
Fri, 4 Aug 2023 16:45:25 +0000 (17:45 +0100)
Check if state->bpf is allocated before attempting to write there.

src/dhcp.c

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