From 9560152f1bdae02b072b54ea65d1e686ebd46e5f Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Fri, 18 Mar 2022 15:35:02 -0400
Subject: [PATCH] Change to strncat
 
ut_line is declared as a nonstring in bits/utmp.h. It might not be NUL
terminated. Limit how much it copies to the size of the array.
 
Reference: https://github.com/shadow-maint/shadow/commit/4f393a5f9fd9168c91225ae1b39843fc90372c74
Conflict: NA
---
 src/logoutd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/logoutd.c b/src/logoutd.c
index 780c29f..06c12c6 100644
--- a/src/logoutd.c
+++ b/src/logoutd.c
@@ -250,7 +250,7 @@ int main (int argc, char **argv)
 				tty_name[0] = '\0';
 			}
 
-			strcat (tty_name, ut->ut_line);
+			strncat (tty_name, ut->ut_line, UT_LINESIZE);
 #ifndef O_NOCTTY
 #define O_NOCTTY 0
 #endif
-- 
2.33.0
