summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2022-07-05 21:00:52 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-06 10:33:10 +0200
commitd903af3614212b9f93a449d189d0d14ff3cd2938 (patch)
treeab04c64644be2d2c8ebed072635023cf4b9a7ccb /Userland/Libraries/LibC
parentd2b7d2440fec1b53903df380b8a8168f084ee792 (diff)
downloadserenity-d903af3614212b9f93a449d189d0d14ff3cd2938.zip
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`.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/grp.cpp7
1 files changed, 0 insertions, 7 deletions
diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp
index 94ad2b2634..5bfa1b7277 100644
--- a/Userland/Libraries/LibC/grp.cpp
+++ b/Userland/Libraries/LibC/grp.cpp
@@ -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)