[FIXED] Critical security bug in sound (again, for real this time)

This commit is contained in:
BlackPhoenix 2008-06-11 20:15:59 +00:00
parent 07cd15ad1f
commit 98a389b7f2

View File

@ -37,11 +37,13 @@ end
function ENT:SetSound(sound)
self:StopSounds()
if (sound) then
util.PrecacheSound(sound)
self.sound = (sound or ""):gsub("[/\\]+","/")
while (string.find(self.sound,"%s") && (string.find(self.sound,"%s") == 1)) do
self.sound = string.Right(self.sound,1)
local parsedsound = sound
while (string.find(parsedsound,"%s") && (string.find(parsedsound,"%s") == 1)) do
parsedsound = string.sub(parsedsound,2,string.len(parsedsound))
end
util.PrecacheSound(parsedsound)
self.sound = (parsedsound or ""):gsub("[/\\]+","/")
self:SetOverlayText( "Sound: " .. self.sound .. "\nOff" )
end
end