Blame 0013-login-utils-logindefs-fix-compiler-warning-Werror-fo.patch

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