Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion utsnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ getutsname(struct tstat *curtask)
if ( (offset = strlen(tmphost) - UTSLEN) < 0)
offset = 0;

strcpy(curtask->gen.utsname, tmphost+offset); // copy last part when overflow
// copy last part when overflow
strncpy(curtask->gen.utsname, tmphost+offset, sizeof(curtask->gen.utsname) - 1);
curtask->gen.utsname[sizeof(curtask->gen.utsname) - 1] = '\0';

if (! droprootprivs())
mcleanstop(42, "failed to drop root privs\n");
Expand Down