Skip to content

Commit

Permalink
sys-utils/ipcutils: be careful when call calloc() for uint64 nmembs
Browse files Browse the repository at this point in the history
Fix: #1395
Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information
karelzak committed Jul 27, 2021
1 parent 03c3aae commit 1c9143d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys-utils/ipcutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static void get_sem_elements(struct sem_data *p)
{
size_t i;

if (!p || !p->sem_nsems || p->sem_perm.id < 0)
if (!p || !p->sem_nsems || p->sem_nsems > SIZE_MAX || p->sem_perm.id < 0)
return;

p->elements = xcalloc(p->sem_nsems, sizeof(struct sem_elem));
Expand Down

0 comments on commit 1c9143d

Please sign in to comment.