From 7ea2c399adab7ad3eac911f3b799b570b30916e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?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 881ea2d5..88643f42 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -113,7 +113,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 ){ @@ -126,7 +126,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 3b1db208..974f64d6 100644 --- a/tools/quake3/q3map2/surface_meta.c +++ b/tools/quake3/q3map2/surface_meta.c @@ -1467,8 +1467,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 ) ) {