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.
This commit is contained in:
Steve Grubb 2022-03-18 15:35:02 -04:00 committed by Serge Hallyn
parent b7bbf1beb8
commit 4f393a5f9f
1 changed files with 1 additions and 1 deletions

View 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