From f4ff002c71e6059cb80415b8c4699bb5a2c7bcb6 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 22 Nov 2012 00:50:16 +0000 Subject: [PATCH] Warn on failure of munmap. Patch based on one by Bill Parker. http://seclists.org/nmap-dev/2012/q4/261 --- CHANGELOG | 2 ++ nmap.cc | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 3ff98f523..4103ea787 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,8 @@ Nmap 6.20BETA1 [2012-11-16] +o Added some new checks for failed library calls. [Bill Parker] + o Integrated all of your IPv4 OS fingerprint submissions since January (more than 3,000 of them). Added 373 fingerprints, bringing the new total to 3,946. Additions include Linux 3.6, Windows 8, Windows diff --git a/nmap.cc b/nmap.cc index 5db435975..41c6673ee 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2336,7 +2336,9 @@ int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv) { /* Ensure the log file ends with a newline */ filestr[filelen - 1] = '\n'; - munmap(filestr, filelen); + if (munmap(filestr, filelen) != 0) + gh_perror("%s: error in munmap(%p, %u)", __func__, filestr, filelen); + return 0; }