summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden Gall <aiden@aidengall.xyz>2023-12-13 17:16:34 +0000
committerAiden Gall <aiden@aidengall.xyz>2023-12-13 18:14:21 +0000
commite97ffa9a4471fd0182017b4d6a2d406a9de03812 (patch)
tree72dc68c835c5c53a76e3fda97db858e7a8d972fb
parent45bff732e97b22ebdcaf20b98ceb0666b368d1c4 (diff)
prevent potential undefined behaviour
-rw-r--r--simplebl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/simplebl.c b/simplebl.c
index 2890bd2..de80227 100644
--- a/simplebl.c
+++ b/simplebl.c
@@ -105,6 +105,8 @@ check_group(void)
glist_size = getgroups(0, NULL);
if (errno)
die("getgroups: %s\n", strerror(errno));
+ if (!glist_size)
+ die("getgroups: User has no supplementary groups\n");
glist = calloc(glist_size, sizeof(*glist));
if (!glist)
die("check_group: Out of memory\n");