mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-28 22:48:05 +03:00
Don't add an invalid decal into custom.hpk, otherwise clients may crash because they have no safe-checks WAD3 MIP-Header.
Related #755 (Only fixes server-side) Fixes #757
This commit is contained in:
parent
07539e225d
commit
7513e71d3b
@ -117,7 +117,9 @@ qboolean COM_CreateCustomization(customization_t *pListHead, resource_t *pResour
|
||||
if ((pCust->resource.ucFlags & RES_CUSTOM) && pCust->resource.type == t_decal)
|
||||
{
|
||||
pCust->resource.playernum = playernumber;
|
||||
if (!CustomDecal_Validate(pCust->pBuffer, pResource->nDownloadSize))
|
||||
|
||||
if (!(flags & FCUST_VALIDATED) && // Don't validate twice
|
||||
!CustomDecal_Validate(pCust->pBuffer, pResource->nDownloadSize))
|
||||
{
|
||||
bError = TRUE;
|
||||
goto CustomizationError;
|
||||
|
@ -3539,6 +3539,18 @@ void SV_ProcessFile(client_t *cl, char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
int iCustomFlags = 0;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!CustomDecal_Validate(cl->netchan.tempbuffer, cl->netchan.tempbuffersize))
|
||||
{
|
||||
Con_Printf("Invalid custom decal from %s\n", cl->name);
|
||||
return;
|
||||
}
|
||||
|
||||
iCustomFlags |= FCUST_VALIDATED;
|
||||
#endif
|
||||
|
||||
HPAK_AddLump(TRUE, "custom.hpk", resource, cl->netchan.tempbuffer, NULL);
|
||||
resource->ucFlags &= ~RES_WASMISSING;
|
||||
SV_MoveToOnHandList(resource);
|
||||
@ -3552,7 +3564,8 @@ void SV_ProcessFile(client_t *cl, char *filename)
|
||||
pList = pList->pNext;
|
||||
}
|
||||
|
||||
if (!COM_CreateCustomization(&cl->customdata, resource, -1, (FCUST_FROMHPAK | FCUST_WIPEDATA | RES_CUSTOM), NULL, NULL))
|
||||
iCustomFlags |= (FCUST_FROMHPAK | FCUST_WIPEDATA | RES_CUSTOM);
|
||||
if (!COM_CreateCustomization(&cl->customdata, resource, -1, iCustomFlags, NULL, NULL))
|
||||
Con_Printf("Error parsing custom decal from %s\n", cl->name);
|
||||
}
|
||||
|
||||
|
@ -106,3 +106,4 @@ typedef struct customization_s
|
||||
#define FCUST_FROMHPAK ( 1<<0 )
|
||||
#define FCUST_WIPEDATA ( 1<<1 )
|
||||
#define FCUST_IGNOREINIT ( 1<<2 )
|
||||
#define FCUST_VALIDATED ( 1<<3 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user