From 90b6ee102f189dc2fd7eb6c5a5648c521ad31152 Mon Sep 17 00:00:00 2001 From: bmenrigh Date: Wed, 18 Mar 2009 19:09:56 +0000 Subject: [PATCH] Fixed a off-by-one error in printtableSize(). The routine was not taking into account the fact that each row gets a newline appended and so was reporting less needed memory that actually necessary in very special cases. Patrick found the issue and reported it in http://seclists.org/nmap-dev/2009/q1/0735.html --- NmapOutputTable.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NmapOutputTable.cc b/NmapOutputTable.cc index bbcf27bf0..b5ca2cc73 100644 --- a/NmapOutputTable.cc +++ b/NmapOutputTable.cc @@ -233,8 +233,8 @@ int NmapOutputTable::printableSize() { // roles then the maximal rowlen needs to be adjusted. for(i = 0; i < numRows; i++) { cell = getCellAddy(i, 0); - if(cell->fullrow && cell->strlength > rowlen) - rowlen = cell->strlength; + if(cell->fullrow && cell->strlength + 1 > rowlen) + rowlen = cell->strlength + 1; /* Account for the newline with the +1 */ } return rowlen * numRows;