git: efeba8da1d2d - stable/13 - libprocstat: make sv_name not static

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 26 Oct 2023 20:39:13 UTC
The branch stable/13 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=efeba8da1d2da9d2c471936415cfad5f63daae76

commit efeba8da1d2da9d2c471936415cfad5f63daae76
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-10-26 20:38:41 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-10-26 20:38:41 +0000

    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)
---
 lib/libprocstat/libprocstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c
index 0d7a0bcc2649..b23a0a5b2120 100644
--- a/lib/libprocstat/libprocstat.c
+++ b/lib/libprocstat/libprocstat.c
@@ -2395,7 +2395,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;