From: Thomas Debesse Date: Tue, 14 Jan 2020 07:06:47 +0000 (+0100) Subject: bsp lump write: pad with zeros, not with random unitialized memory data X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=58894ce5c53871fbca2f57e2d2345ca8bdc8890d;p=xonotic%2Fnetradiant.git bsp lump write: pad with zeros, not with random unitialized memory data --- diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index fb8af399..62beb16a 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -341,14 +341,17 @@ 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 */ + char *zeros[3] = { 0, 0, 0 }; + SafeWrite( file, zeros, ( ( length + 3 ) & ~3 ) - length ); }