mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibC: Fix truncated strncpy() in getlogin()
This commit is contained in:
parent
dda9ffe906
commit
d1ffdea550
Notes:
sideshowbarker
2024-07-19 07:38:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d1ffdea5501
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…
Reference in a new issue