Skip to content

Commit

Permalink
Fix a misaligned write
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki Izumi committed Jun 30, 2017
1 parent 71b0d00 commit 0fbab47
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ static void *arena_calloc(size_t nmem, size_t size) {
}
void *ptr = (uint8_t *) A->ptr + A->used;
A->used += sz;
*((size_t *) ptr) = nmem * size;
size_t new_sz = nmem * size;
memcpy(ptr, &new_sz, sizeof(new_sz));
return (uint8_t *) ptr + sizeof(size_t);
}

Expand Down

0 comments on commit 0fbab47

Please sign in to comment.