Page MenuHomeFreeBSD

ifconfig: Fix invalid free() in ifbridge
ClosedPublic

Authored by ivy on Nov 3 2025, 5:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 1, 8:50 AM
Unknown Object (File)
Sun, Nov 30, 7:42 AM
Unknown Object (File)
Sun, Nov 30, 5:37 AM
Unknown Object (File)
Fri, Nov 28, 10:20 AM
Unknown Object (File)
Thu, Nov 20, 2:08 AM
Unknown Object (File)
Thu, Nov 20, 2:08 AM
Unknown Object (File)
Thu, Nov 20, 2:02 AM
Unknown Object (File)
Thu, Nov 13, 7:01 PM
Subscribers

Details

Summary

parse_vlans() does 's = strdup(str)', then calls strsep(&s, ...), then
attempts to free(s) at the end of the function. For the success case,
this is fine (s is NULL, so it's a trivial memory leak), but in the
error case, we will attempt to free an invalid pointer.

Fix this by storing the original return value from strdup() and freeing
that instead.

Reported by: David Gwynne <dlg@openbsd.org>
MFC after: 3 days

Diff Detail

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