From e97ffa9a4471fd0182017b4d6a2d406a9de03812 Mon Sep 17 00:00:00 2001 From: Aiden Gall Date: Wed, 13 Dec 2023 17:16:34 +0000 Subject: prevent potential undefined behaviour --- simplebl.c | 2 ++ 1 file changed, 2 insertions(+) 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"); -- cgit v1.2.3