]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Change to strncat
authorSteve Grubb <sgrubb@redhat.com>
Fri, 18 Mar 2022 19:35:02 +0000 (15:35 -0400)
committerSerge Hallyn <serge@hallyn.com>
Fri, 18 Mar 2022 21:02:01 +0000 (16:02 -0500)
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

index d369acf45bd70a65d95238daa7f56675030b961e..03680f3f3979d898592248e60c11892ce22528db 100644 (file)
@@ -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