Page MenuHomeFreeBSD

pkg: Use a global buffer for local ABI string
AbandonedPublic

Authored by jhb on Nov 13 2023, 10:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 7, 8:55 PM
Unknown Object (File)
Fri, Mar 6, 9:04 AM
Unknown Object (File)
Fri, Mar 6, 1:01 AM
Unknown Object (File)
Thu, Mar 5, 10:38 AM
Unknown Object (File)
Thu, Mar 5, 8:56 AM
Unknown Object (File)
Wed, Feb 25, 8:20 AM
Unknown Object (File)
Mon, Feb 23, 6:54 AM
Unknown Object (File)
Feb 7 2026, 4:45 PM
Subscribers

Details

Summary

Otherwise c[ABI].val can point to a no-longer-valid on-stack buffer
after config_init returns.

Reported by: GCC 13 -Wdangling-pointer

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54407
Build 51297: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Nov 13 2023, 10:30 PM
This revision is now accepted and ready to land.Nov 14 2023, 12:24 AM

OK with me, or we could have pkg_get_myabi asprintf it?

OK with me, or we could have pkg_get_myabi asprintf it?

I don't know that we really need that extra complexity TBH. But alternatively, yes, I would make pkg_get_myabi() return an allocated string that the caller has to manage the lifetime of.

Actually, I like the asprintf version better, so I will upload that in a bit.

Sorry for making more work for you :)