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-16 17:53:22 +01:00
parent 9b48cb8e89
commit ff90744045

View file

@ -2434,8 +2434,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;