exploit patch (#2975)

* soundemitter and soundPlay patched

* this is better + fix emitsound

* more efficient order + 260 char limit instead

* emitsound invalid character check
This commit is contained in:
zynx 2024-01-08 16:36:38 +02:00 committed by GitHub
parent 33fa54337a
commit 730d702e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -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
@ -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)

View File

@ -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
@ -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()