diff --git a/rehlds/engine/com_custom.cpp b/rehlds/engine/com_custom.cpp index 0d7e9a9..f760381 100644 --- a/rehlds/engine/com_custom.cpp +++ b/rehlds/engine/com_custom.cpp @@ -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; diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 15922ee..f81c410 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -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); } diff --git a/rehlds/public/rehlds/custom.h b/rehlds/public/rehlds/custom.h index d2ebd48..2116ed4 100644 --- a/rehlds/public/rehlds/custom.h +++ b/rehlds/public/rehlds/custom.h @@ -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 )