git: 88a592407ef7 - stable/14 - libc/stdlib/getenv.c: always allocate new environment
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Oct 2026 00:30:10 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=88a592407ef7df6e1140231f9316e5b607444eb6
commit 88a592407ef7df6e1140231f9316e5b607444eb6
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-24 18:30:57 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-09 00:29:53 +0000
libc/stdlib/getenv.c: always allocate new environment
PR: 298747
(cherry picked from commit dec68aeff8ce0ce154e93325a74bba6af71c87af)
---
lib/libc/stdlib/getenv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index f8f59526421a..7a7912d3f703 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -267,7 +267,7 @@ __rebuild_environ(int newEnvironSize)
int tmpEnvironSize;
/* Resize environ. */
- if (newEnvironSize > environSize) {
+ if (newEnvironSize > environSize || intEnviron == NULL) {
tmpEnvironSize = newEnvironSize * 2;
tmpEnviron = reallocarray(intEnviron, tmpEnvironSize + 1,
sizeof(*intEnviron));