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
@@ -231,7 +231,7 @@ int find_new_uid(bool sys_user,
|
||||
*/
|
||||
|
||||
/* Create an array to hold all of the discovered UIDs */
|
||||
used_uids = malloc (sizeof (bool) * (uid_max +1));
|
||||
used_uids = mallocarray (uid_max + 1, sizeof (bool));
|
||||
if (NULL == used_uids) {
|
||||
fprintf (log_get_logfd(),
|
||||
_("%s: failed to allocate memory: %s\n"),
|
||||
|
||||
Reference in New Issue
Block a user