mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibC: Fix validation logic error in construct_pwd()
Previously this would've always succeeded, even if a copy failed. Oops...
This commit is contained in:
parent
a8765fa673
commit
ba294efd8e
1 changed files with 5 additions and 5 deletions
|
@ -152,11 +152,11 @@ static void construct_pwd(struct passwd* pwd, char* buf, struct passwd** result)
|
|||
auto* buf_shell = &buf[s_dir.length() + 1 + s_gecos.length() + 1 + s_name.length() + 1 + s_gecos.length() + 1];
|
||||
|
||||
bool ok = true;
|
||||
ok = ok || s_name.copy_characters_to_buffer(buf_name, s_name.length() + 1);
|
||||
ok = ok || s_passwd.copy_characters_to_buffer(buf_passwd, s_passwd.length() + 1);
|
||||
ok = ok || s_gecos.copy_characters_to_buffer(buf_gecos, s_gecos.length() + 1);
|
||||
ok = ok || s_dir.copy_characters_to_buffer(buf_dir, s_dir.length() + 1);
|
||||
ok = ok || s_shell.copy_characters_to_buffer(buf_shell, s_shell.length() + 1);
|
||||
ok = ok && s_name.copy_characters_to_buffer(buf_name, s_name.length() + 1);
|
||||
ok = ok && s_passwd.copy_characters_to_buffer(buf_passwd, s_passwd.length() + 1);
|
||||
ok = ok && s_gecos.copy_characters_to_buffer(buf_gecos, s_gecos.length() + 1);
|
||||
ok = ok && s_dir.copy_characters_to_buffer(buf_dir, s_dir.length() + 1);
|
||||
ok = ok && s_shell.copy_characters_to_buffer(buf_shell, s_shell.length() + 1);
|
||||
|
||||
VERIFY(ok);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue