Thursday, June 01, 2023

Re: netstat: vfprintf %s NULL in " %2d %-5.16s"

Stuart Henderson <stu.lists@spacehopper.org> wrote:

> On 2023-05-31, Benjamin Stürz <benni+openbsd@stuerz.xyz> wrote:
> > Hi misc@,
> >
> > while scrolling through my /var/log/messages I found this entry:
> > netstat: vfprintf %s NULL in " %2d %-5.16s"
> >
> > I tracked down the issue to line 278 of /usr/src/usr.bin/netstat/show.c:
> >> printf(" %2d %-5.16s", rtm->rtm_priority,
> >> if_indextoname(rtm->rtm_index, ifbuf))
> > It appears to me that if_indextoname(3) returns NULL for some reason,
> > and that this isn't being checked.
> >
> > Is this intentional? Or did I find a minor bug?
>
> I'd guess at a race, probably the route was pointing at a virtual
> interface that was removed during printing of the route table.

Still needs to be fixed, so that the code checks for NULL return before
passing it as a parameter. That means figuring out what to do in that
case.

No comments:

Post a Comment