Skip to content

Commit 63be13a

Browse files
author
James McLaughlin
committed
Prevent zero-byte allocations
1 parent b19c2f1 commit 63be13a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

json.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ static void default_free (void * ptr, void * user_data)
8787

8888
static void * json_alloc (json_state * state, unsigned long size, int zero)
8989
{
90+
if (size == 0)
91+
size = 1;
92+
9093
if ((state->ulong_max - state->used_memory) < size)
9194
return 0;
9295

0 commit comments

Comments
 (0)