mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Replace sprintf()/strcat() with snprintf()
This commit is contained in:
parent
e8201b115f
commit
61ce0d1117
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue