mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:48:11 +00:00
LibC: Prefer strlcpy over strcpy/strncpy
All of these are cosmetic (I believe). Furthermore, they serve as reminders to always check the length of the destination buffers.
This commit is contained in:
parent
aa36e9917c
commit
d419a780ae
3 changed files with 13 additions and 13 deletions
|
@ -554,7 +554,7 @@ char* getlogin()
|
|||
{
|
||||
static char __getlogin_buffer[256];
|
||||
if (auto* passwd = getpwuid(getuid())) {
|
||||
strncpy(__getlogin_buffer, passwd->pw_name, sizeof(__getlogin_buffer) - 1);
|
||||
strlcpy(__getlogin_buffer, passwd->pw_name, sizeof(__getlogin_buffer));
|
||||
endpwent();
|
||||
return __getlogin_buffer;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue