summaryrefslogtreecommitdiff
path: root/lib/group-member.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/group-member.c')
-rw-r--r--lib/group-member.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/group-member.c b/lib/group-member.c
index 7c4ce496753..cd43f36f4eb 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -1,19 +1,19 @@
/* group-member.c -- determine whether group id is in calling user's group list
- Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2017 Free Software
+ Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2022 Free Software
Foundation, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
@@ -21,12 +21,11 @@
/* Specification. */
#include <unistd.h>
+#include <stdckdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
-#include "xalloc-oversized.h"
-
/* Most processes have no more than this many groups, and for these
processes we can avoid using malloc. */
enum { GROUPBUF_SIZE = 100 };
@@ -53,10 +52,10 @@ get_group_info (struct group_info *gi)
if (n_groups < 0)
{
int n_group_slots = getgroups (0, NULL);
- if (0 <= n_group_slots
- && ! xalloc_oversized (n_group_slots, sizeof *gi->group))
+ size_t nbytes;
+ if (! ckd_mul (&nbytes, n_group_slots, sizeof *gi->group))
{
- gi->group = malloc (n_group_slots * sizeof *gi->group);
+ gi->group = malloc (nbytes);
if (gi->group)
n_groups = getgroups (n_group_slots, gi->group);
}