diff --git a/tools/quake3/q3map2/bspfile_abstract.cpp b/tools/quake3/q3map2/bspfile_abstract.cpp index 1d8f206d..0d569d91 100644 --- a/tools/quake3/q3map2/bspfile_abstract.cpp +++ b/tools/quake3/q3map2/bspfile_abstract.cpp @@ -161,7 +161,8 @@ void SwapBSPFile( void ){ si = ShaderInfoForShader( bspShaders[ i ].shader ); if ( !strEmptyOrNull( si->remapShader ) ) { // copy and clear the rest of memory // check for overflow by String64 - strncpy( bspShaders[ i ].shader, String64()( si->remapShader ), sizeof( bspShaders[ i ].shader ) ); + const auto remap = String64()( si->remapShader ); + strncpy( bspShaders[ i ].shader, remap, sizeof( bspShaders[ i ].shader ) ); } } bspShaders[ i ].contentFlags = LittleLong( bspShaders[ i ].contentFlags ); diff --git a/tools/quake3/q3map2/writebsp.cpp b/tools/quake3/q3map2/writebsp.cpp index 4be049bf..0f983656 100644 --- a/tools/quake3/q3map2/writebsp.cpp +++ b/tools/quake3/q3map2/writebsp.cpp @@ -79,8 +79,8 @@ int EmitShader( const char *shader, int *contentFlags, int *surfaceFlags ){ AUTOEXPAND_BY_REALLOC_BSP( Shaders, 1024 ); numBSPShaders++; - // copy and clear the rest of memory // check for overflow by String64 - strncpy( bspShaders[ i ].shader, String64()( shader ), sizeof( bspShaders[ i ].shader ) ); + // copy and clear the rest of memory + strncpy( bspShaders[ i ].shader, si->shader, sizeof( bspShaders[ i ].shader ) ); bspShaders[ i ].surfaceFlags = si->surfaceFlags; bspShaders[ i ].contentFlags = si->contentFlags; @@ -497,8 +497,8 @@ void EmitFogs( void ){ for ( i = 0; i < numMapFogs; i++ ) { /* set shader */ - // copy and clear the rest of memory // check for overflow by String64 - strncpy( bspFogs[ i ].shader, String64()( mapFogs[ i ].si->shader ), sizeof( bspFogs[ i ].shader ) ); + // copy and clear the rest of memory + strncpy( bspFogs[ i ].shader, mapFogs[ i ].si->shader, sizeof( bspFogs[ i ].shader ) ); /* global fog doesn't have an associated brush */ if ( mapFogs[ i ].brush == NULL ) {