mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[WINESYNC] msvcrt: Handle overflow in calloc().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 50dd4b892825c75db35cd1f378291b51fa782f3e by Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
977e236102
commit
1d6ec8555d
1 changed files with 9 additions and 1 deletions
|
@ -418,7 +418,15 @@ size_t CDECL _aligned_msize(void *p, MSVCRT_size_t alignment, MSVCRT_size_t offs
|
|||
*/
|
||||
void* CDECL MSVCRT_calloc(MSVCRT_size_t count, MSVCRT_size_t size)
|
||||
{
|
||||
return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, count*size);
|
||||
MSVCRT_size_t bytes = count*size;
|
||||
|
||||
if (size && bytes / size != count)
|
||||
{
|
||||
*MSVCRT__errno() = MSVCRT_ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, bytes);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
Loading…
Reference in a new issue