mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibC: Fix truncated strncpy() in getlogin()
This commit is contained in:
parent
dda9ffe906
commit
d1ffdea550
1 changed files with 1 additions and 1 deletions
|
@ -538,7 +538,7 @@ char* getlogin()
|
|||
{
|
||||
static char __getlogin_buffer[256];
|
||||
if (auto* passwd = getpwuid(getuid())) {
|
||||
strncpy(__getlogin_buffer, passwd->pw_name, sizeof(__getlogin_buffer));
|
||||
strncpy(__getlogin_buffer, passwd->pw_name, sizeof(__getlogin_buffer) - 1);
|
||||
endpwent();
|
||||
return __getlogin_buffer;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue