diff --git a/FingerPrintResults.cc b/FingerPrintResults.cc index dfe631db4..e5950a31c 100644 --- a/FingerPrintResults.cc +++ b/FingerPrintResults.cc @@ -146,7 +146,7 @@ const char *FingerPrintResults::OmitSubmissionFP() { static char reason[128]; if (o.scan_delay > 500) { // This can screw up the sequence timing - snprintf(reason, sizeof(reason), "Scan delay (%d) is greater than 500", o.scan_delay); + Snprintf(reason, sizeof(reason), "Scan delay (%d) is greater than 500", o.scan_delay); return reason; } @@ -164,17 +164,17 @@ const char *FingerPrintResults::OmitSubmissionFP() { used to mean the distance is unknown, though there's a chance it could have come from the distance calculation. */ if (distance < -1) { - snprintf(reason, sizeof(reason), "Host distance (%d network hops) appears to be negative", distance); + Snprintf(reason, sizeof(reason), "Host distance (%d network hops) appears to be negative", distance); return reason; } if (distance > 5) { - snprintf(reason, sizeof(reason), "Host distance (%d network hops) is greater than five", distance); + Snprintf(reason, sizeof(reason), "Host distance (%d network hops) is greater than five", distance); return reason; } if (maxTimingRatio > 1.4) { - snprintf(reason, sizeof(reason), "maxTimingRatio (%e) is greater than 1.4", maxTimingRatio); + Snprintf(reason, sizeof(reason), "maxTimingRatio (%e) is greater than 1.4", maxTimingRatio); return reason; } diff --git a/NmapOps.cc b/NmapOps.cc index fb6abce3c..27d260ad3 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -248,7 +248,7 @@ void NmapOps::Initialize() { #if WIN32 Strncpy(tmpxsl, "nmap.xsl", sizeof(tmpxsl)); #else - snprintf(tmpxsl, sizeof(tmpxsl), "%s/nmap.xsl", NMAPDATADIR); + Snprintf(tmpxsl, sizeof(tmpxsl), "%s/nmap.xsl", NMAPDATADIR); #endif if (xsl_stylesheet) free(xsl_stylesheet); xsl_stylesheet = strdup(tmpxsl); diff --git a/NmapOutputTable.cc b/NmapOutputTable.cc index 96486545c..62a515837 100644 --- a/NmapOutputTable.cc +++ b/NmapOutputTable.cc @@ -199,7 +199,7 @@ void NmapOutputTable::addItemFormatted(unsigned int row, va_list ap; va_start(ap,fmt); char buf[4096]; - res = vsnprintf(buf, sizeof(buf), fmt, ap); + res = Vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if (res > sizeof(buf)) diff --git a/Target.cc b/Target.cc index 88e7c7b4c..a4d9de739 100644 --- a/Target.cc +++ b/Target.cc @@ -317,7 +317,7 @@ const char *Target::NameIP(char *buf, size_t buflen) { assert(buf); assert(buflen > 8); if (hostname) { - snprintf(buf, buflen, "%s (%s)", hostname, targetipstring); + Snprintf(buf, buflen, "%s (%s)", hostname, targetipstring); } else Strncpy(buf, targetipstring, buflen); return buf; } diff --git a/idle_scan.cc b/idle_scan.cc index 4690b6f80..437ca7075 100644 --- a/idle_scan.cc +++ b/idle_scan.cc @@ -398,7 +398,7 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName, p = strdup(proxy->host.targetipstr()); q = strdup(inet_ntoa(proxy->host.v4source())); - snprintf(filter, sizeof(filter), "tcp and src host %s and dst host %s and src port %hu", p, q, proxy->probe_port); + Snprintf(filter, sizeof(filter), "tcp and src host %s and dst host %s and src port %hu", p, q, proxy->probe_port); free(p); free(q); set_pcap_filter(proxy->host.deviceName(), proxy->pd, filter); @@ -978,7 +978,7 @@ void idle_scan(Target *target, u16 *portarray, int numports, int portsleft; time_t starttime; char scanname[32]; - snprintf(scanname, sizeof(scanname), "Idlescan against %s", target->NameIP()); + Snprintf(scanname, sizeof(scanname), "Idlescan against %s", target->NameIP()); ScanProgressMeter SPM(scanname); if (numports == 0) return; /* nothing to scan for */ @@ -1032,7 +1032,7 @@ void idle_scan(Target *target, u16 *portarray, int numports, char additional_info[14]; - snprintf(additional_info, sizeof(additional_info), "%d ports", numports); + Snprintf(additional_info, sizeof(additional_info), "%d ports", numports); SPM.endTask(NULL, additional_info); /* Now we go through the ports which were not determined were scanned diff --git a/main.cc b/main.cc index a7e1fe09e..02f28cb2f 100644 --- a/main.cc +++ b/main.cc @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { #endif if ((cptr = getenv("NMAP_ARGS"))) { - if (snprintf(command, sizeof(command), "nmap %s", cptr) >= (int) sizeof(command)) { + if (Snprintf(command, sizeof(command), "nmap %s", cptr) >= (int) sizeof(command)) { error("Warning: NMAP_ARGS variable is too long, truncated"); } /* copy rest of command-line arguments */ @@ -322,7 +322,7 @@ int main(int argc, char *argv[]) { if (endptr) { *endptr = '\0'; } - snprintf(nmappath, sizeof(nmappath), "%s/%s", pptr, nmapcalledas); + Snprintf(nmappath, sizeof(nmappath), "%s/%s", pptr, nmapcalledas); if (stat(nmappath, &st) != -1) break; nmappath[0] = '\0'; diff --git a/nmap.cc b/nmap.cc index 9af8e31d7..f22a86bf2 100644 --- a/nmap.cc +++ b/nmap.cc @@ -824,11 +824,11 @@ int nmap_main(int argc, char *argv[]) { xmlfilename = optarg; } else if (strcmp(long_options[option_index].name, "oA") == 0) { char buf[MAXPATHLEN]; - snprintf(buf, sizeof(buf), "%s.nmap", optarg); + Snprintf(buf, sizeof(buf), "%s.nmap", optarg); normalfilename = strdup(buf); - snprintf(buf, sizeof(buf), "%s.gnmap", optarg); + Snprintf(buf, sizeof(buf), "%s.gnmap", optarg); machinefilename = strdup(buf); - snprintf(buf, sizeof(buf), "%s.xml", optarg); + Snprintf(buf, sizeof(buf), "%s.xml", optarg); xmlfilename = strdup(buf); } else if (strcmp(long_options[option_index].name, "thc") == 0) { printf("!!Greets to Van Hauser, Plasmoid, Skyper and the rest of THC!!\n"); @@ -1390,7 +1390,7 @@ int nmap_main(int argc, char *argv[]) { char xslline[1024]; if (xslfname) { char *p = xml_convert(xslfname); - snprintf(xslline, sizeof(xslline), "\n", p); + Snprintf(xslline, sizeof(xslline), "\n", p); free(p); } else xslline[0] = '\0'; log_write(LOG_XML, "\n%s