opnsense-src/usr.sbin/pkg
John Baldwin 2012748bd7 pkg: Allocate a suitably-sized string for the local ABI
Previously the local ABI string was written to an on-stack buffer and
the pointer to that buffer was saved in a global before the function
returned.  This had two issues: c[ABI].val pointed to a
no-longer-valid on-stack buffer after config_init returned, and the
string could potentially be truncated.  Fix both of those by changing
pkg_get_myabi to return a pointer to a string allocated by asprintf.

Note that the allocated string is left in the global config array
until it is implicitly freed on process exit.

Reported by:	GCC 13 -Wdangling-pointer
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42623

(cherry picked from commit fd9ae9ac04edf9acef4a2ffbf663698a2b8e7ced)
2024-01-03 09:43:48 -08:00
..
config.c pkg: Allocate a suitably-sized string for the local ABI 2024-01-03 09:43:48 -08:00
config.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
dns_utils.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
dns_utils.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
FreeBSD.conf.latest pkg: use https by default 2023-12-04 11:20:56 +01:00
FreeBSD.conf.quarterly pkg: use https by default 2023-12-04 11:20:56 +01:00
hash.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
hash.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
pkg.7 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
pkg.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00