From: Thomas Köppe Date: Sun, 14 Aug 2016 00:08:28 +0000 (+0100) Subject: [tools/quake3/q3map2] Fix memset size bugs X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1337e610e6cf4310670af7083f132517d82de928;p=xonotic%2Fnetradiant.git [tools/quake3/q3map2] Fix memset size bugs --- diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index 1dab66db..6d5946bc 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -104,7 +104,7 @@ void SetDrawSurfacesBuffer(){ bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" ); - memset( bspDrawSurfaces, 0, MAX_MAP_DRAW_SURFS * sizeof( bspDrawVert_t ) ); + memset( bspDrawSurfaces, 0, MAX_MAP_DRAW_SURFS * sizeof( bspDrawSurface_t ) ); } void SetDrawSurfaces( int n ){ @@ -117,7 +117,7 @@ void SetDrawSurfaces( int n ){ bspDrawSurfaces = safe_malloc_info( sizeof( bspDrawSurface_t ) * numBSPDrawSurfacesBuffer, "IncDrawSurfaces" ); - memset( bspDrawSurfaces, 0, n * sizeof( bspDrawVert_t ) ); + memset( bspDrawSurfaces, 0, n * sizeof( bspDrawSurface_t ) ); } void BSPFilesCleanup(){ diff --git a/tools/quake3/q3map2/surface_meta.c b/tools/quake3/q3map2/surface_meta.c index 8d4f3c36..f3afa1a6 100644 --- a/tools/quake3/q3map2/surface_meta.c +++ b/tools/quake3/q3map2/surface_meta.c @@ -1704,8 +1704,8 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles, ClearBounds( ds->mins, ds->maxs ); /* clear verts/indexes */ - memset( verts, 0, sizeof( verts ) ); - memset( indexes, 0, sizeof( indexes ) ); + memset( verts, 0, sizeof( *verts ) * maxSurfaceVerts ); + memset( indexes, 0, sizeof( *indexes ) * maxSurfaceIndexes ); /* add the first triangle */ if ( AddMetaTriangleToSurface( ds, seed, qfalse ) ) {