Skip to content

Commit

Permalink
Fix crashes from large material path
Browse files Browse the repository at this point in the history
(cherry picked from commit 88faa3f)
  • Loading branch information
thegrb93 authored and Anticept committed Jul 21, 2019
1 parent 93b4d18 commit 9b748c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/entities/gmod_wire_expression2/core/egpfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/wire/server/wirelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b748c9

Please sign in to comment.