From 96a895f26c0ea8b5cd426743dc2b8845aabaf423 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 11 Jun 2026 13:14:36 -0400 Subject: Return when item is NULL * Explicitly state error condition --- src/lib/core/environment.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/core/environment.c b/src/lib/core/environment.c index 4623db8..b4ab66e 100644 --- a/src/lib/core/environment.c +++ b/src/lib/core/environment.c @@ -445,9 +445,14 @@ void runtime_set(RuntimeEnv *env, const char *_key, char *_value) { */ void runtime_apply(RuntimeEnv *env) { for (size_t i = 0; i < strlist_count(env); i++) { - char **pair = split(strlist_item(env, i), "=", 1); + const char *item = strlist_item(env, i); + if (!item) { + SYSERROR("failed to read from env list"); + return; + } + char **pair = split((char *) item, "=", 1); if (!pair) { - SYSERROR("unable to allocate memory for runtime_apply"); + SYSERROR("unable to allocate memory for key/value pair"); return; } setenv(pair[0], pair[1], 1); -- cgit