mirror of
https://github.com/nmap/nmap.git
synced 2026-01-17 03:49:02 +00:00
Fix an off-by-one error in traceroute consolidation. In debugging mode,
the list of consolidated hops (the ones that match the reference trace) was printed out one hop further than it should have been. So if a trace diverged from the reference trace at the sixth hop, it would print out the first six hops of the reference trace when it should have done only five. This extra row, as well as being incorrect, could cause an assertion failure by making the output table one row bigger than its preallocated capacity.
This commit is contained in:
@@ -901,9 +901,7 @@ Traceroute::outputTarget(Target * t) {
|
||||
this->outputXMLTrace(tg);
|
||||
|
||||
/* table headers */
|
||||
/* This should be tg->hopDistance + 1, but there is a bug that sometimes
|
||||
causes an extra row to be printed. */
|
||||
Tbl = new NmapOutputTable(tg->hopDistance+2, 3);
|
||||
Tbl = new NmapOutputTable(tg->hopDistance+1, 3);
|
||||
Tbl->addItem(row_count, HOP_COL, false, "HOP", 3);
|
||||
Tbl->addItem(row_count, RTT_COL, false, "RTT", 3);
|
||||
Tbl->addItem(row_count, HOST_COL, false, "ADDRESS", 7);
|
||||
@@ -913,7 +911,7 @@ Traceroute::outputTarget(Target * t) {
|
||||
assert(row_count <= tg->hopDistance);
|
||||
|
||||
/* consolidate hops based on the reference trace (commonPath) */
|
||||
if (commonPath[ttl_count] && ttl_count <= tg->consolidation_start) {
|
||||
if (commonPath[ttl_count] && ttl_count < tg->consolidation_start) {
|
||||
/* do not consolidate in debug mode */
|
||||
if (o.debugging) {
|
||||
row_count++;
|
||||
|
||||
Reference in New Issue
Block a user