Lukáš Zaoral bf0817
From 2616c6be1c244424617997151c67bcab2dacbcfe Mon Sep 17 00:00:00 2001
Lukáš Zaoral bf0817
From: rpm-build <rpm-build>
Lukáš Zaoral bf0817
Date: Thu, 31 Aug 2023 14:34:05 +0200
Lukáš Zaoral bf0817
Subject: [PATCH] coreutils-9.4-systemd-coredump.patch
Lukáš Zaoral bf0817
Lukáš Zaoral bf0817
Cherry picked from gnulib upstream commits:
Lukáš Zaoral bf0817
* 1e6a26f9312bb47e070f94b17b14dc1a6ffbb74f ("readutmp: fix core dump if --enable-systemd")
Lukáš Zaoral bf0817
* 3af1d7b0ce3a8e3ae565e7cea10cee6fd7cb8109 ("readutmp: Fix memory leak introduced by last commit.")
Lukáš Zaoral bf0817
---
Lukáš Zaoral bf0817
 lib/readutmp.c | 2 +-
Lukáš Zaoral bf0817
 1 file changed, 1 insertion(+), 1 deletion(-)
Lukáš Zaoral bf0817
Lukáš Zaoral bf0817
diff --git a/lib/readutmp.c b/lib/readutmp.c
Lukáš Zaoral bf0817
index 0173b7e..ec09feb 100644
Lukáš Zaoral bf0817
--- a/lib/readutmp.c
Lukáš Zaoral bf0817
+++ b/lib/readutmp.c
Lukáš Zaoral bf0817
@@ -795,7 +795,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
Lukáš Zaoral bf0817
     {
Lukáš Zaoral bf0817
       char **sessions;
Lukáš Zaoral bf0817
       int num_sessions = sd_get_sessions (&sessions);
Lukáš Zaoral bf0817
-      if (num_sessions >= 0)
Lukáš Zaoral bf0817
+      if (num_sessions >= 0 && sessions != NULL)
Lukáš Zaoral bf0817
         {
Lukáš Zaoral bf0817
           char **session_ptr;
Lukáš Zaoral bf0817
           for (session_ptr = sessions; *session_ptr != NULL; session_ptr++)
Lukáš Zaoral bf0817
-- 
Lukáš Zaoral bf0817
2.41.0
Lukáš Zaoral bf0817