From 52bb3299b7328cc4d8248a21984bb81d1132cf14 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Thu, 1 Apr 2021 05:12:43 +0100 Subject: [PATCH] Another day, another bug found by Polo - this time in sendevent with entity references. --- Quake/pr_ext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Quake/pr_ext.c b/Quake/pr_ext.c index 9e5c17b4..8b3aa7f4 100644 --- a/Quake/pr_ext.c +++ b/Quake/pr_ext.c @@ -5557,6 +5557,7 @@ static void PF_cl_sendevent(void) const char *eventargs = G_STRING(OFS_PARM1); int a; eval_t *val; + edict_t *ed; MSG_WriteByte(&cls.message, clcfte_qcrequest); for (a = 2; a < 8 && *eventargs; a++, eventargs++) @@ -5582,8 +5583,9 @@ static void PF_cl_sendevent(void) MSG_WriteFloat(&cls.message, G_FLOAT(OFS_PARM0+a*3+2)); break; case 'e': + ed = G_EDICT(OFS_PARM0+a*3); MSG_WriteByte(&cls.message, ev_entity); - val = GetEdictFieldValue(host_client->edict, ED_FindFieldOffset("entnum")); //we need to transmit the SERVER's number, the client's number is meaningless to it. + val = GetEdictFieldValue(ed, ED_FindFieldOffset("entnum")); //we need to transmit the SERVER's number, the client's number is meaningless to it. MSG_WriteEntity(&cls.message, val?val->_float:0, cl.protocol_pext2); break; }