dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
dbeef3
From 53af90a8edf2e60342b477d28e0d802dc26f18b7 Mon Sep 17 00:00:00 2001
dbeef3
From: Karel Zak <kzak@redhat.com>
dbeef3
Date: Tue, 9 Aug 2022 12:35:05 +0200
dbeef3
Subject: lslogins: improve for static analyzer
dbeef3
dbeef3
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2094216
dbeef3
Signed-off-by: Karel Zak <kzak@redhat.com>
dbeef3
---
dbeef3
 login-utils/lslogins.c | 2 +-
dbeef3
 1 file changed, 1 insertion(+), 1 deletion(-)
dbeef3
dbeef3
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
dbeef3
index ff4386d1b..56431212d 100644
dbeef3
--- a/login-utils/lslogins.c
dbeef3
+++ b/login-utils/lslogins.c
dbeef3
@@ -852,7 +852,7 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
dbeef3
 				while (p && *p == '!')
dbeef3
 					p++, i++;
dbeef3
 
dbeef3
-				if (i != 0 && (!*p || valid_pwd(p)))
dbeef3
+				if (i != 0 && p && (!*p || valid_pwd(p)))
dbeef3
 					user->pwd_lock = STATUS_TRUE;
dbeef3
 			} else
dbeef3
 				user->pwd_lock = STATUS_UNKNOWN;
dbeef3
-- 
dbeef3
2.37.1
dbeef3