From 4292115ef741ff066b382c094f8c7814afaccf59 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 14 Jan 2020 08:06:47 +0100 Subject: [PATCH] bsp lump write: pad with zeros, not with random unitialized memory data --- tools/quake3/q3map2/bspfile_abstract.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index 02e9c06b..b0cb34ba 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -330,14 +330,16 @@ int CopyLump_Allocate( bspHeader_t *header, int lump, void **dest, int size, int void AddLump( FILE *file, bspHeader_t *header, int lumpNum, const void *data, int length ){ bspLump_t *lump; - /* add lump to bsp file header */ lump = &header->lumps[ lumpNum ]; lump->offset = LittleLong( ftell( file ) ); lump->length = LittleLong( length ); /* write lump to file */ - SafeWrite( file, data, ( length + 3 ) & ~3 ); + SafeWrite( file, data, length ); + + /* write padding zeros */ + SafeWrite( file, (const byte[3]){ 0, 0, 0 }, ( ( length + 3 ) & ~3 ) - length ); }