]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_send.c
net: fix UB in VM_CL_getstati() and when sending the `items` stat
[xonotic/darkplaces.git] / sv_send.c
index a8a44347724791acfc0f179655e2c010ae2dd65a..ae2d9b9df38271742c26bf0bd829ef22d5a178d7 100644 (file)
--- a/sv_send.c
+++ b/sv_send.c
@@ -1145,7 +1145,9 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        // the runes are in serverflags, pack them into the items value, also pack
        // in the items2 value for mission pack huds
        // (used only in the mission packs, which do not use serverflags)
-       items = (int)PRVM_serveredictfloat(ent, items) | ((int)PRVM_serveredictfloat(ent, items2) << 23) | ((int)PRVM_serverglobalfloat(serverflags) << 28);
+       items = (int)PRVM_serveredictfloat(ent, items)
+               | (((int)PRVM_serveredictfloat(ent, items2) & ((1<<9)-1)) << 23)
+               | (((int)PRVM_serverglobalfloat(serverflags) & ((1<<4)-1)) << 28);
 
        VectorCopy(PRVM_serveredictvector(ent, punchvector), punchvector);