From 9b748c90836205af4dd82484b9638af604e982ab Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Sun, 21 Jul 2019 16:42:04 -0400 Subject: [PATCH] Fix crashes from large material path (cherry picked from commit 88faa3fbdbe0453ffe781b6df8f8f76ac80473f1) --- lua/entities/gmod_wire_expression2/core/egpfunctions.lua | 1 + lua/wire/server/wirelib.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua index 6e22eefae3..b13b8dc7a8 100644 --- a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua @@ -675,6 +675,7 @@ end ---------------------------- e2function void wirelink:egpMaterial( number index, string material ) if (!EGP:IsAllowed( self, this )) then return end + material = WireLib.IsValidMaterial(material) local bool, k, v = EGP:HasObject( this, index ) if (bool) then if (EGP:EditObject( v, { material = material } )) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index 446c1835db..95c0e0561a 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1176,6 +1176,7 @@ local material_blacklist = { ["effects/ar2_altfire1"] = true } function WireLib.IsValidMaterial(material) + material = string.sub(material, 1, 260) local path = string.StripExtension(string.GetNormalizedFilepath(string.lower(material))) if material_blacklist[path] then return "" end return material