mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Don't divide by zero if sodium_allocarray() is called with count=0
This commit is contained in:
@@ -416,7 +416,7 @@ sodium_allocarray(size_t count, size_t size)
|
||||
{
|
||||
size_t total_size;
|
||||
|
||||
if (size >= (size_t) SIZE_MAX / count) {
|
||||
if (count > (size_t) 0U && size >= (size_t) SIZE_MAX / count) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user