]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
[tools/quake3/q3map2] Fix memset size bugs
authorThomas Köppe <tkoeppe@google.com>
Sun, 14 Aug 2016 00:08:28 +0000 (01:08 +0100)
committerThomas Debesse <dev@illwieckz.net>
Fri, 14 Oct 2016 00:40:14 +0000 (02:40 +0200)
tools/quake3/q3map2/bspfile_abstract.c
tools/quake3/q3map2/surface_meta.c

index 1dab66dbda76c4cf7a83b62b9d3816ab0d0e431d..6d5946bccf1cea33b78a3c7d6d37263f7fe8f3f3 100644 (file)
@@ -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(){
index 8d4f3c36ffdc009bdab45be92fa8b5600bbfbe49..f3afa1a6caf036b4dc759b596a4f58d77fc1715e 100644 (file)
@@ -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 ) ) {