Page MenuHomeFreeBSD

systat: Fix a bunch of use after frees in fetch_ifstat().
ClosedPublic

Authored by jhb on Sep 29 2022, 10:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 9, 4:19 AM
Unknown Object (File)
Tue, May 5, 1:58 AM
Unknown Object (File)
Sat, May 2, 10:03 PM
Unknown Object (File)
Tue, Apr 28, 8:58 AM
Unknown Object (File)
Sat, Apr 25, 6:32 PM
Unknown Object (File)
Apr 18 2026, 1:02 PM
Unknown Object (File)
Apr 18 2026, 11:05 AM
Unknown Object (File)
Apr 17 2026, 9:49 PM
Subscribers

Details

Summary

I think this was probably just a typo. initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by: GCC 12 -Wuse-after-free

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable