Download raw body.
traceroute: fix segfault when some arguments are repeated
Hi,
Make sure that internal counters do not go out of bounds
if the '-n' or '-A' options are specified more than once.
best regards,
peter
--
Index: traceroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/traceroute/traceroute.c,v
diff -u -p -r1.170 traceroute.c
--- traceroute.c 21 Aug 2024 15:00:25 -0000 1.170
+++ traceroute.c 14 Feb 2026 05:54:28 -0000
@@ -429,8 +429,10 @@ main(int argc, char *argv[])
"ADdf:g:Ilm:nP:p:q:Ss:t:V:vw:x")) != -1)
switch (ch) {
case 'A':
- conf->Aflag = 1;
- conf->expected_responses++;
+ if (!conf->Aflag) {
+ conf->Aflag = 1;
+ conf->expected_responses++;
+ }
break;
case 'd':
conf->dflag = 1;
@@ -479,8 +481,10 @@ main(int argc, char *argv[])
conf->first_ttl, MAXTTL);
break;
case 'n':
- conf->nflag = 1;
- conf->expected_responses--;
+ if (!conf->nflag) {
+ conf->nflag = 1;
+ conf->expected_responses--;
+ }
break;
case 'p':
conf->port = strtonum(optarg, 1, 65535, &errstr);
traceroute: fix segfault when some arguments are repeated