daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
9fc0f6
From c6d39712453c53e8c859d6682f65d8129afc35a3 Mon Sep 17 00:00:00 2001
9fc0f6
From: Lennart Poettering <lennart@poettering.net>
9fc0f6
Date: Wed, 2 Oct 2013 19:38:28 +0200
9fc0f6
Subject: [PATCH] strv: don't access potentially NULL string arrays
9fc0f6
9fc0f6
---
9fc0f6
 src/shared/env-util.c | 4 +++-
9fc0f6
 1 file changed, 3 insertions(+), 1 deletion(-)
9fc0f6
9fc0f6
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
9fc0f6
index 5e29629..7976881 100644
9fc0f6
--- a/src/shared/env-util.c
9fc0f6
+++ b/src/shared/env-util.c
9fc0f6
@@ -405,7 +405,9 @@ char **strv_env_clean_log(char **e, const char *message) {
9fc0f6
                 e[k++] = *p;
9fc0f6
         }
9fc0f6
 
9fc0f6
-        e[k] = NULL;
9fc0f6
+        if (e)
9fc0f6
+                e[k] = NULL;
9fc0f6
+
9fc0f6
         return e;
9fc0f6
 }
9fc0f6