Replace instances of sprintf(buf, "literal") with bufset macro

This commit is contained in:
dmiller 2026-07-17 21:56:27 +00:00
parent 52d6e70cfd
commit 16a39eaf76
2 changed files with 8 additions and 8 deletions

View file

@ -374,31 +374,31 @@ char * NpingOps::mode2Ascii(int md) {
switch( md ){
case TCP_CONNECT:
sprintf(buff, "TCP-Connect");
bufset(buff, "TCP-Connect");
break;
case TCP:
sprintf(buff, "TCP");
bufset(buff, "TCP");
break;
case UDP:
sprintf(buff, "UDP");
bufset(buff, "UDP");
break;
case UDP_UNPRIV:
sprintf(buff, "UDP-Unprivileged");
bufset(buff, "UDP-Unprivileged");
break;
case ICMP:
sprintf(buff, "ICMP");
bufset(buff, "ICMP");
break;
case ARP:
sprintf(buff, "ARP");
bufset(buff, "ARP");
break;
default:
sprintf(buff, "Unknown mode");
bufset(buff, "Unknown mode");
break;
}
return buff;

View file

@ -1209,7 +1209,7 @@ const char *ProbeMode::getBPFFilterString(){
inet_ntop(AF_INET, &s4->sin_addr, ipstring, sizeof(ipstring));
}else{
nping_warning(QT_2, "Warning: Wrong address family (%d) in getBPFFilterString(). Please report a bug", srcss.ss_family);
sprintf(ipstring,"127.0.0.1");
bufset(ipstring,"127.0.0.1");
}
/* Tell the filter that we only want incoming packets, destined to our source IP */