]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Properly bound some positive numbers sent via WriteShort
authorterencehill <piuntn@gmail.com>
Thu, 3 Jun 2021 20:39:54 +0000 (22:39 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 3 Jun 2021 20:39:54 +0000 (22:39 +0200)
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/server/items/items.qc

index 043ee685313805bc5084d4eb7e5198552f9c3ecf..97c26f360dd19d037b166ce6ff25181a59b604c1 100644 (file)
@@ -65,7 +65,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
     {
         WriteCoord(MSG_ENTITY, this.fade_time);
         WriteCoord(MSG_ENTITY, this.teleport_time);
-        WriteShort(MSG_ENTITY, this.fade_rate); // maxdist
+        WriteShort(MSG_ENTITY, bound(0, this.fade_rate, 32767)); // maxdist
         WriteByte(MSG_ENTITY, hide_flags);
     }
 
index 403125eea51b7ef9c41bcbfdea6aa6c654405991..f0d8e3835e38d9310af0c6525049a0ec54d8392d 100644 (file)
@@ -54,8 +54,8 @@ bool ItemSend(entity this, entity to, int sf)
 
        if(sf & ISF_MODEL)
        {
-               WriteShort(MSG_ENTITY, this.fade_end);
-               WriteShort(MSG_ENTITY, this.fade_start);
+               WriteShort(MSG_ENTITY, bound(0, this.fade_end, 32767));
+               WriteShort(MSG_ENTITY, bound(0, this.fade_start, 32767));
 
                if(this.mdl == "")
                        LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "expect a crash just about now");