From af38333f71279743228be3656c606a74c5b4fa0b Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 7 Jun 2024 16:45:58 -0400 Subject: ensure there is an environment at all --- src/stdlib/getenv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdlib/getenv.c b/src/stdlib/getenv.c index a2747998..3c459e1d 100644 --- a/src/stdlib/getenv.c +++ b/src/stdlib/getenv.c @@ -17,7 +17,7 @@ char * getenv(const char * name) } len = strlen(name); - for (i = 0; __stdlib_h.environ[i] != NULL; i++) { + for (i = 0; __stdlib_h.environ && __stdlib_h.environ[i] != NULL; i++) { if (!strncmp(__stdlib_h.environ[i], name, len) && __stdlib_h.environ[i][len] == '=') { __readonly(RO_UNLOCK, variable); strcpy(variable, __stdlib_h.environ[i] + len + 1); -- cgit v1.2.1