From b9960b09acad929a98f745aa3d1d96fe70cafa1e Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Thu, 4 Oct 2018 16:53:31 +0200 Subject: [PATCH] Avoid a NULL pointer dereference. --- gtests/net/packetdrill/packet_socket_pcap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtests/net/packetdrill/packet_socket_pcap.c b/gtests/net/packetdrill/packet_socket_pcap.c index c349c700..57eb63df 100644 --- a/gtests/net/packetdrill/packet_socket_pcap.c +++ b/gtests/net/packetdrill/packet_socket_pcap.c @@ -126,7 +126,7 @@ void packet_socket_set_filter(struct packet_socket *psock, const struct ether_addr *client_ether_addr, const struct ip_address *client_live_ip) { - const u8 *client_ether = client_ether_addr->ether_addr_octet; + const u8 *client_ether; struct bpf_program bpf_code; char *filter_str = NULL; char client_live_ip_string[ADDR_STR_LEN]; @@ -134,6 +134,7 @@ void packet_socket_set_filter(struct packet_socket *psock, ip_to_string(client_live_ip, client_live_ip_string); if (client_ether_addr != NULL) + client_ether = client_ether_addr->ether_addr_octet; asprintf(&filter_str, "ether src %02x:%02x:%02x:%02x:%02x:%02x and %s src %s", client_ether[0], -- GitLab