diff --git a/pcsx2/DEV9/pcap_io.cpp b/pcsx2/DEV9/pcap_io.cpp index c257c8f6fa..df76595a27 100644 --- a/pcsx2/DEV9/pcap_io.cpp +++ b/pcsx2/DEV9/pcap_io.cpp @@ -321,11 +321,10 @@ bool PCAPAdapter::InitPCAP(const std::string& adapter, bool promiscuous) bool PCAPAdapter::SetMACSwitchedFilter(MAC_Address mac) { bpf_program fp; - char filter[1024] = "ether broadcast or ether dst "; - char virtual_mac_str[18]; - sprintf(virtual_mac_str, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", mac.bytes[0], mac.bytes[1], mac.bytes[2], mac.bytes[3], mac.bytes[4], mac.bytes[5]); - strcat(filter, virtual_mac_str); + char filter[128]; + std::snprintf(filter, std::size(filter), "ether broadcast or ether dst %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", + mac.bytes[0], mac.bytes[1], mac.bytes[2], mac.bytes[3], mac.bytes[4], mac.bytes[5]); if (pcap_compile(hpcap, &fp, filter, 1, PCAP_NETMASK_UNKNOWN) == -1) {