Skip to content

Commit

Permalink
exploit patch (#2975)
Browse files Browse the repository at this point in the history
* soundemitter and soundPlay patched

* this is better + fix emitsound

* more efficient order + 260 char limit instead

* emitsound invalid character check
  • Loading branch information
gmZynx authored Jan 8, 2024
1 parent 33fa543 commit 730d702
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions lua/entities/gmod_wire_expression2/core/sound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ local function soundStop(self, index, fade)
end

local function soundCreate(self, entity, index, time, path, fade)
path = string.Trim(string.sub(path, 1, 260))
if path:match('["?]') then return end
local data = self.data.sound_data
if not isAllowed( self ) then return end

path = path:Trim()
path = path:gsub( "\\", "/" )
if isnumber( index ) then index = math.floor( index ) end

local timerid = "E2_sound_stop_" .. self.entity:EntIndex() .. "_" .. index
Expand Down Expand Up @@ -303,7 +302,9 @@ local function EmitSound(e2, ent, snd, level, pitch, volume)
level = maxlevel
end

ent:EmitSound(snd, level, pitch, volume)
snd = string.sub(snd, 1, 260)
if snd:match('["?]') then return end
ent:EmitSound(snd, level, pitch, volume)
end

__e2setcost(20)
Expand Down
8 changes: 4 additions & 4 deletions lua/entities/gmod_wire_soundemitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ end
function ENT:SetSound(soundName)
self:StopSounds()

soundName = string.Trim(string.sub(soundName, 1, 260))
if soundName:match('["?]') then return end
parsedsound = soundName:Trim()
util.PrecacheSound(parsedsound)
util.PrecacheSound(soundName)

self.sound = parsedsound
self.sound = soundName

self.SoundProperties = sound.GetProperties(self.sound)
if self.SoundProperties then
Expand All @@ -175,7 +175,7 @@ function ENT:SetSound(soundName)
WireLib.TriggerOutput(self, "Properties", {})
end

self:SetOverlayText( parsedsound:gsub("[/\\]+","/") )
self:SetOverlayText( soundName:gsub("[/\\]+","/") )
end

function ENT:StartSounds()
Expand Down

0 comments on commit 730d702

Please sign in to comment.