dcavalca / rpms / util-linux

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