From bd2a44dbdd1162b7b6e8c7b34f9553be53c9b6fd Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 8 Aug 2024 06:11:52 +0300 Subject: [PATCH] engine: common: fix fragbuf_t definition so it has true standard flexible array member --- engine/common/net_chan.c | 2 +- engine/common/netchan.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 1043ab32..7c1a4985 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -513,7 +513,7 @@ static fragbuf_t *Netchan_AllocFragbuf( int fragment_size ) { fragbuf_t *buf; - buf = (fragbuf_t *)Mem_Calloc( net_mempool, sizeof( fragbuf_t ) + ( fragment_size - 1 ) ); + buf = (fragbuf_t *)Mem_Calloc( net_mempool, sizeof( fragbuf_t ) + fragment_size ); MSG_Init( &buf->frag_message, "Frag Message", buf->frag_message_buf, fragment_size ); return buf; diff --git a/engine/common/netchan.h b/engine/common/netchan.h index 0c2a76ea..d6335341 100644 --- a/engine/common/netchan.h +++ b/engine/common/netchan.h @@ -190,7 +190,7 @@ typedef struct fragbuf_s char filename[MAX_OSPATH]; // name of the file to save out on remote host int foffset; // offset in file from which to read data int size; // size of data to read at that offset - byte frag_message_buf[1]; // the actual data sits here (flexible) + byte frag_message_buf[]; // the actual data sits here (flexible) } fragbuf_t; // Waiting list of fragbuf chains