libprocstat: copy all the 32-bit auxv entries

Use source struct size not the destination struct size so we copy all
the auxv entries, not just the first half of them.

Fix a style issue on an adjacent line.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42200

(cherry picked from commit 8f06fabe39)
This commit is contained in:
Brooks Davis 2023-10-26 21:38:41 +01:00
parent efeba8da1d
commit ea7f064a78

View File

@ -2437,8 +2437,8 @@ procstat_getauxv32_sysctl(pid_t pid, unsigned int *cntp)
warn("sysctl: kern.proc.auxv: %d: %d", pid, errno);
goto out;
}
count = len / sizeof(Elf_Auxinfo);
auxv = malloc(count * sizeof(Elf_Auxinfo));
count = len / sizeof(Elf32_Auxinfo);
auxv = malloc(count * sizeof(Elf_Auxinfo));
if (auxv == NULL) {
warn("malloc(%zu)", count * sizeof(Elf_Auxinfo));
goto out;