Skip to content

Commit

Permalink
Cast zlib malloc size to size_t before multiply.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet committed Nov 23, 2024
1 parent 424ff2d commit 18b7a54
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ static int check_header_coherency(FILE *fp, packfile_t *entry)

static voidpf FS_zalloc(voidpf opaque, uInt items, uInt size)
{
return FS_Malloc(items * size);
return FS_Malloc((size_t)items * size);
}

static void FS_zfree(voidpf opaque, voidpf address)
Expand Down
2 changes: 1 addition & 1 deletion src/server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2152,7 +2152,7 @@ static void sv_hostname_changed(cvar_t *self)
#if USE_ZLIB
voidpf SV_zalloc(voidpf opaque, uInt items, uInt size)
{
return SV_Malloc(items * size);
return SV_Malloc((size_t)items * size);
}

void SV_zfree(voidpf opaque, voidpf address)
Expand Down
2 changes: 1 addition & 1 deletion src/server/mvd/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ static void send_stream_stop(gtv_t *gtv)
#if USE_ZLIB
static voidpf gtv_zalloc(voidpf opaque, uInt items, uInt size)
{
return MVD_Malloc(items * size);
return MVD_Malloc((size_t)items * size);
}

static void gtv_zfree(voidpf opaque, voidpf address)
Expand Down

0 comments on commit 18b7a54

Please sign in to comment.