From: Florian Obser Subject: Re: traceroute: fix segfault when some arguments are repeated To: tech@openbsd.org Date: Mon, 16 Feb 2026 13:38:31 +0100 Nice one. OK florian or I can commit it if someone wants to OK it. On 2026-02-14 08:17 +02, Petre Rodan wrote: > 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); > -- In my defence, I have been left unsupervised.