]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
also support entity lumps that are NOT NUL terminated
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Jan 2009 17:01:49 +0000 (17:01 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 1 Jan 2009 17:01:49 +0000 (17:01 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8616 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index 4512c541c487960e19c479e3130b71dbac44d4e0..ebd60e33d7fe6524ba948f5ef947d3bb0de5409f 100644 (file)
@@ -1835,8 +1835,9 @@ static void Mod_Q1BSP_LoadEntities(lump_t *l)
        loadmodel->brush.entities = NULL;
        if (!l->filelen)
                return;
-       loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen);
+       loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen + 1);
        memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
+       loadmodel->brush.entities[l->filelen] = 0;
        if (loadmodel->brush.ishlbsp)
                Mod_Q1BSP_ParseWadsFromEntityLump(loadmodel->brush.entities);
 }
@@ -4167,8 +4168,9 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
        loadmodel->brushq3.num_lightgrid_cellsize[2] = 128;
        if (!l->filelen)
                return;
-       loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen);
+       loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen + 1);
        memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
+       loadmodel->brush.entities[l->filelen] = 0;
        data = loadmodel->brush.entities;
        // some Q3 maps override the lightgrid_cellsize with a worldspawn key
        if (data && COM_ParseToken_Simple(&data, false, false) && com_token[0] == '{')