LibC: Don't clear static storage during endgrent
The POSIX documentation for `endgrent` only mentions that it "closes the group database", not that it clears the backing storage for return values. This means that applications might make use of the returned values even after closing the group database itself. This includes our own implementations for `getgrnam` and `getgrgid`. The specification also states that "the storage areas might be overwritten by a subsequent call to `getgrgid`, `getgrnam`, or `getgrent`". This implies that `getgrgid` and `getgrnam` aren't meant to have their own static storage and instead rely on the storage of `getgrent`.
This commit is contained in:
parent
d2b7d2440f
commit
d903af3614
Notes:
sideshowbarker
2024-07-18 03:35:30 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/d903af3614 Pull-request: https://github.com/SerenityOS/serenity/pull/14498
1 changed files with 0 additions and 7 deletions
|
@ -47,13 +47,6 @@ void endgrent()
|
|||
fclose(s_stream);
|
||||
s_stream = nullptr;
|
||||
}
|
||||
|
||||
memset(&s_group, 0, sizeof(s_group));
|
||||
|
||||
s_name = {};
|
||||
s_passwd = {};
|
||||
s_members = {};
|
||||
s_members_ptrs = {};
|
||||
}
|
||||
|
||||
struct group* getgrgid(gid_t gid)
|
||||
|
|
Loading…
Add table
Reference in a new issue