mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 18:08:23 +00:00
Add missing check for reallocarray() failure.
Found by OSS-Fuzz.
This commit is contained in:
parent
bca213959b
commit
aa50aaf8da
@ -479,6 +479,8 @@ ldif_to_sudoers(struct sudoers_parse_tree *parse_tree,
|
|||||||
|
|
||||||
/* Convert from list of roles to array and sort by order. */
|
/* Convert from list of roles to array and sort by order. */
|
||||||
role_array = reallocarray(NULL, numroles + 1, sizeof(*role_array));
|
role_array = reallocarray(NULL, numroles + 1, sizeof(*role_array));
|
||||||
|
if (role_array == NULL)
|
||||||
|
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||||
for (n = 0; n < numroles; n++) {
|
for (n = 0; n < numroles; n++) {
|
||||||
if ((role = STAILQ_FIRST(roles)) == NULL)
|
if ((role = STAILQ_FIRST(roles)) == NULL)
|
||||||
break; /* cannot happen */
|
break; /* cannot happen */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user