From 4f393a5f9fd9168c91225ae1b39843fc90372c74 Mon Sep 17 00:00:00 2001 From: Steve Grubb 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. --- src/logoutd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logoutd.c b/src/logoutd.c index d369acf4..03680f3f 100644 --- a/src/logoutd.c +++ b/src/logoutd.c @@ -228,7 +228,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