]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
crash fix: make --xml not to dump core 146/head
authorSami Kerola <kerolasa@iki.fi>
Sun, 28 Aug 2016 23:55:24 +0000 (00:55 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 29 Aug 2016 00:00:36 +0000 (01:00 +0100)
This also makes --report option to print values rather than %5N.  And in
same go remove a floating point exception.

Crash these issues were introduced in caad4c42fb8ef0d830fd37608a96702d6774f93f

mtr.c
report.c

diff --git a/mtr.c b/mtr.c
index 437e1e4f7cbca0ddebc9c29784d970ffc596435b..17ae2651698ea8b20886c508821e0f074d80d484 100644 (file)
--- a/mtr.c
+++ b/mtr.c
@@ -70,8 +70,8 @@ struct fields data_fields[MAXFLD] = {
   {' ', "<sp>: Space between fields", " ",  " ",        1, &net_drop  },
   {'L', "L: Loss Ratio",          "Loss%",  " %4.1f%%", 6, &net_loss  },
   {'D', "D: Dropped Packets",     "Drop",   " %4d",     5, &net_drop  },
-  {'R', "R: Received Packets",    "Rcv",    " %5N",     6, &net_returned},
-  {'S', "S: Sent Packets",        "Snt",    " %5N",     6, &net_xmit  },
+  {'R', "R: Received Packets",    "Rcv",    " %5d",     6, &net_returned},
+  {'S', "S: Sent Packets",        "Snt",    " %5d",     6, &net_xmit  },
   {'N', "N: Newest RTT(ms)",      "Last",   " %5.1f",   6, &net_last  },
   {'B', "B: Min/Best RTT(ms)",    "Best",   " %5.1f",   6, &net_best  },
   {'A', "A: Average RTT(ms)",     "Avg",    " %5.1f",   6, &net_avg   },
index 61b09e43f44055febd2ab8ff05a8d26613d48808..86fdab01f70a6136321b6a91763a4f92406d50d7 100644 (file)
--- a/report.c
+++ b/report.c
@@ -97,7 +97,7 @@ extern void report_close(struct mtr_ctl *ctl)
   
 #ifdef HAVE_IPINFO
   int len_tmp = len_hosts;
-  if (ctl->ipinfo_no >= 0) {
+  if (ctl->ipinfo_no >= 0 && ctl->iiwidth_len) {
     ctl->ipinfo_no %= ctl->iiwidth_len;
     if (ctl->reportwide) {
       len_hosts++;    // space