dbeef3
From 1c4ee8348e220b633d676214fd585ee2b3945cf6 Mon Sep 17 00:00:00 2001
dbeef3
From: Karel Zak <kzak@redhat.com>
dbeef3
Date: Mon, 6 Jun 2022 16:14:14 +0200
dbeef3
Subject: login-utils/logindefs: fix compiler warning
dbeef3
 [-Werror=format-truncation=]
dbeef3
dbeef3
Upstream: http://github.com/util-linux/util-linux/commit/977f98ee34ca002cb5301c2d3a5953c754f813ec
dbeef3
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2094216
dbeef3
Signed-off-by: Karel Zak <kzak@redhat.com>
dbeef3
---
dbeef3
 login-utils/logindefs.c | 3 ++-
dbeef3
 1 file changed, 2 insertions(+), 1 deletion(-)
dbeef3
dbeef3
diff --git a/login-utils/logindefs.c b/login-utils/logindefs.c
dbeef3
index 97150dc28..95631223a 100644
dbeef3
--- a/login-utils/logindefs.c
dbeef3
+++ b/login-utils/logindefs.c
dbeef3
@@ -521,7 +521,8 @@ int get_hushlogin_status(struct passwd *pwd, int force_check)
dbeef3
 		if (strlen(pwd->pw_dir) + strlen(file) + 2 > sizeof(buf))
dbeef3
 			continue;
dbeef3
 
dbeef3
-		sprintf(buf, "%s/%s", pwd->pw_dir, file);
dbeef3
+		if (snprintf(buf, sizeof(buf), "%s/%s", pwd->pw_dir, file) < 0)
dbeef3
+			continue;
dbeef3
 
dbeef3
 		if (force_check) {
dbeef3
 			uid_t ruid = getuid();
dbeef3
-- 
dbeef3
2.36.1
dbeef3