From 1337e610e6cf4310670af7083f132517d82de928 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20K=C3=B6ppe?= Date: Sun, 14 Aug 2016 01:08:28 +0100 Subject: [PATCH] [tools/quake3/q3map2] Fix memset size bugs --- tools/quake3/q3map2/bspfile_abstract.c | 4 ++-- tools/quake3/q3map2/surface_meta.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 ) ) { -- 2.39.2