diff --git a/nmap.cc b/nmap.cc index fac51628d..ae14d5e97 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2002,7 +2002,7 @@ int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv) { fatal("Unable to parse supposed log file %s. Perhaps the Nmap execution had not finished at least one host? In that case there is no use \"resuming\"", fname); - strcpy(nmap_arg_buffer, "nmap --append-output "); + strncpy(nmap_arg_buffer, "nmap --append-output ", sizeof(nmap_arg_buffer)); if ((q-p) + 21 + 1 >= (int) sizeof(nmap_arg_buffer)) fatal("0verfl0w"); memcpy(nmap_arg_buffer + 21, p, q-p); nmap_arg_buffer[21 + q-p] = '\0'; diff --git a/osscan2.cc b/osscan2.cc index a0dc9179f..b2700f2d0 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -2702,7 +2702,7 @@ bool HostOsScan::get_tcpopt_string(struct tcp_hdr *tcp, int mss, char *result, i break; /* Window Scale option has 3 bytes */ *p++ = 'W'; q++; - sprintf(p, "%hX", *((u8*)q)); + snprintf(p, length, "%hX", *((u8*)q)); p += strlen(p); /* max movement of p is 2 (max WScale value is 0xFF) */ q++; length -= 3; diff --git a/output.cc b/output.cc index ae134f5ff..8bfcbac9e 100644 --- a/output.cc +++ b/output.cc @@ -549,7 +549,7 @@ void printportoutput(Target * currenths, PortList * plist) { fatal("Unable to properly format host start time"); log_write(LOG_PLAIN, "Scanned at %s for %lds\n", - tbufs, tm_sece - tm_secs); + tbufs, (long) (tm_sece - tm_secs)); } log_write(LOG_MACHINE, "Host: %s (%s)", currenths->targetipstr(), currenths->HostName());