Use *array() allocation functions where appropriate
This prevents overflow from multiplication. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
727275a027
commit
191f04f7dc
@@ -2150,7 +2150,7 @@ int main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
sys_ngroups = sysconf (_SC_NGROUPS_MAX);
|
||||
user_groups = (char **) malloc (sizeof (char *) * (1 + sys_ngroups));
|
||||
user_groups = (char **) mallocarray (sys_ngroups + 1, sizeof (char *));
|
||||
user_groups[0] = NULL;
|
||||
|
||||
is_shadow_pwd = spw_file_present ();
|
||||
|
Reference in New Issue
Block a user