From 1736dde56c2f3a4d7c0ed490ab0a63a84e3376f0 Mon Sep 17 00:00:00 2001 From: fyodor Date: Sun, 19 Jul 2009 07:23:32 +0000 Subject: [PATCH] Applied patch: o Fixed a log_write call and a pfatal call to use a syntax which is safer from format strings bugs. This allows Nmap to build with the gcc -Wformat -Werror=format-security options. [Guillaume Rousse] --- CHANGELOG | 4 ++++ output.cc | 2 +- scan_engine.cc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3fe416146..d60e85cdc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,10 @@ o Made RPC grinding work from service detection again by changing the looked-for service name from "rpc" to "rpcbind", the name it has in nmap-service-probes. [David] +o Fixed a log_write call and a pfatal call to use a syntax which is + safer from format strings bugs. This allows Nmap to build with the + gcc -Wformat -Werror=format-security options. [Guillaume Rousse] + o [Ndiff] Ndiff now shows changes in script output. [David] o A bug in Nsock was fixed: On systems where a nonblocking connect diff --git a/output.cc b/output.cc index 8fb35f991..965471b4d 100644 --- a/output.cc +++ b/output.cc @@ -566,7 +566,7 @@ void printportoutput(Target *currenths, PortList *plist) { currenths->NameIP(hostname, sizeof(hostname)), (numignoredports == 1)? "is" : "are"); if (plist->numIgnoredStates() == 1) { - log_write(LOG_PLAIN, statenum2str(plist->nextIgnoredState(PORT_UNKNOWN))); + log_write(LOG_PLAIN, "%s", statenum2str(plist->nextIgnoredState(PORT_UNKNOWN))); } else { prevstate = PORT_UNKNOWN; while ((istate = plist->nextIgnoredState(prevstate)) != PORT_UNKNOWN) { diff --git a/scan_engine.cc b/scan_engine.cc index 762519352..993ece532 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -3783,7 +3783,7 @@ static bool do_one_select_round(UltraScanInfo *USI, struct timeval *stime) { case ENETRESET: case ECONNABORTED: Snprintf(buf, sizeof(buf), "Strange SO_ERROR from connection to %s (%d - '%s') -- bailing scan", host->target->targetipstr(), optval, strerror(optval) ); - pfatal(buf); + pfatal("%s", buf); break; default: Snprintf(buf, sizeof(buf), "Strange read error from %s (%d - '%s')", host->target->targetipstr(), optval, strerror(optval));