From fd3b2c79d3a0fbb4977e82d6ccdabf47e59a02da Mon Sep 17 00:00:00 2001 From: d33tah Date: Thu, 31 Jul 2014 14:28:20 +0000 Subject: [PATCH] Don't write to XML output directly in nmap.cc. Spotted and fixed by Michal Hrusecki (http://seclists.org/nmap-dev/2014/q3/180). --- nmap.cc | 1 - xml.cc | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nmap.cc b/nmap.cc index a5be648f1..c61cf2037 100644 --- a/nmap.cc +++ b/nmap.cc @@ -1748,7 +1748,6 @@ int nmap_main(int argc, char *argv[]) { chomp(mytime); char *xslfname = o.XSLStyleSheet(); xml_start_document(); - log_write(LOG_XML, "\n", NMAP_XMLOUTPUTVERSION); if (xslfname) { xml_open_pi("xml-stylesheet"); xml_attribute("href", "%s", xslfname); diff --git a/xml.cc b/xml.cc index 26c9725f4..27997bc5a 100644 --- a/xml.cc +++ b/xml.cc @@ -320,6 +320,8 @@ int xml_start_document() { if (xml_newline() < 0) return -1; + log_write(LOG_XML, "\n", NMAP_XMLOUTPUTVERSION); + return 0; }