src/usermod,groups: use checked malloc

usermod.c:2165:24: warning: dereference of possibly-NULL ‘user_groups’ [CWE-690] [-Wanalyzer-possible-null-dereference]
This commit is contained in:
Christian Göttsche
2023-12-14 07:40:40 -06:00
committed by Serge Hallyn
parent 76bbce3564
commit 95a8de2a0a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ int main (int argc, char **argv)
GETGROUPS_T *groups;
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
groups = MALLOC(sys_ngroups, GETGROUPS_T);
groups = XMALLOC(sys_ngroups, GETGROUPS_T);
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);
+1 -1
View File
@@ -2161,7 +2161,7 @@ int main (int argc, char **argv)
#endif
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
user_groups = MALLOC(sys_ngroups + 1, char *);
user_groups = XMALLOC(sys_ngroups + 1, char *);
user_groups[0] = NULL;
is_shadow_pwd = spw_file_present ();