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
F131907443: D42583.diff
Sun, Oct 12, 3:23 AM
Unknown Object (File)
Thu, Oct 2, 2:15 PM
Unknown Object (File)
Fri, Sep 19, 2:14 PM
Unknown Object (File)
Sep 6 2025, 6:47 AM
Unknown Object (File)
Aug 14 2025, 10:48 PM
Unknown Object (File)
Jun 12 2025, 5:12 AM
Unknown Object (File)
Jun 5 2025, 4:55 PM
Unknown Object (File)
May 23 2025, 5:38 AM
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 :)