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:
committed by
Serge Hallyn
parent
76bbce3564
commit
95a8de2a0a
@@ -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);
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
Reference in New Issue
Block a user