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-11 17:09:06 +01:00
committed by Serge Hallyn
parent 76bbce3564
commit 95a8de2a0a
2 changed files with 2 additions and 2 deletions
+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 ();