aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2023-10-16 16:53:11 +0000
committerBrooks Davis <brooks@FreeBSD.org>2023-10-25 23:30:51 +0000
commit9b48cb8e89c86128c1d9d89eea67ef4b28a38c52 (patch)
tree269a074b08d966f5ef4f31ac5385b683ff37364c
parentd65a002ded1fef6a9dce796252a73bd65104e1af (diff)
downloadsrc-9b48cb8e89c86128c1d9d89eea67ef4b28a38c52.tar.gz
src-9b48cb8e89c86128c1d9d89eea67ef4b28a38c52.zip
libprocstat: make sv_name not static
Making this variable static makes is_elf32_sysctl() and callers thread unsafe. Use a less absurd length for sv_name. The longest name in the system is "FreeBSD ELF64 V2" which tips the scales at 16+1 bytes. We'll almost certainly have other problems if we exceed 32 characters. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42199 (cherry picked from commit 72a4ee26a7c665ae1c31abe1c6feeaa7ccaba140)
-rw-r--r--lib/libprocstat/libprocstat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index e5481c53eea1..84502bb895b7 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -2392,7 +2392,7 @@ is_elf32_sysctl(pid_t pid)
{
int error, name[4];
size_t len, i;
- static char sv_name[256];
+ char sv_name[32];
name[0] = CTL_KERN;
name[1] = KERN_PROC;