From 1072f6b15ea55174cccdcc1c2da6cd6c37784e07 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 3 Mar 2013 01:59:37 +0000 Subject: [PATCH] restrict which CHANNELFLAG_ values can be used in sound7 builtin, to keep qc from using internal-only ones git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11924 d7cf8633-e32d-0410-b094-e92efae38249 --- clvm_cmds.c | 5 ++++- svvm_cmds.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clvm_cmds.c b/clvm_cmds.c index 7cde1d91..04d03a9b 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -206,7 +206,10 @@ static void VM_CL_sound (prvm_prog_t *prog) if (prog->argc < 7) flags = 0; else - flags = PRVM_G_FLOAT(OFS_PARM6); + { + // LordHavoc: we only let the qc set certain flags, others are off-limits + flags = (int)PRVM_G_FLOAT(OFS_PARM6) & (CHANNELFLAG_RELIABLE | CHANNELFLAG_FORCELOOP | CHANNELFLAG_PAUSED); + } // sound_starttime exists instead of sound_startposition because in a // networking sense you might not know when something is being received, diff --git a/svvm_cmds.c b/svvm_cmds.c index c13608de..e9d51fdf 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -554,7 +554,10 @@ static void VM_SV_sound(prvm_prog_t *prog) } } else - flags = PRVM_G_FLOAT(OFS_PARM6); + { + // LordHavoc: we only let the qc set certain flags, others are off-limits + flags = (int)PRVM_G_FLOAT(OFS_PARM6) & (CHANNELFLAG_RELIABLE | CHANNELFLAG_FORCELOOP | CHANNELFLAG_PAUSED); + } if (volume < 0 || volume > 255) { -- 2.39.2