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)
Fri, Jan 30, 12:14 AM
Unknown Object (File)
Thu, Jan 22, 11:09 PM
Unknown Object (File)
Wed, Jan 14, 1:19 PM
Unknown Object (File)
Wed, Jan 14, 12:06 PM
Unknown Object (File)
Wed, Jan 14, 12:06 PM
Unknown Object (File)
Dec 31 2025, 2:21 PM
Unknown Object (File)
Dec 1 2025, 8:50 AM
Unknown Object (File)
Nov 30 2025, 7:42 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 68365
Build 65248: arc lint + arc unit