From: havoc Date: Wed, 25 May 2005 07:57:04 +0000 (+0000) Subject: fix an overflow without allowoverflow set error in EntityFrame5 sending of stats X-Git-Tag: xonotic-v0.1.0preview~4845 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eca922f8d360b2f8022bf6ccbec2f19cf5250eb2;p=xonotic%2Fdarkplaces.git fix an overflow without allowoverflow set error in EntityFrame5 sending of stats git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5336 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/protocol.c b/protocol.c index 0c047113..8367824d 100644 --- a/protocol.c +++ b/protocol.c @@ -2103,6 +2103,11 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int num } } + // if there isn't at least enough room for an empty svc_entities, + // don't bother trying... + if (buf.cursize + 11 > buf.maxsize) + return; + // build lists of entities by priority level memset(entityframe5_prioritychaincounts, 0, sizeof(entityframe5_prioritychaincounts)); l = 0; @@ -2124,7 +2129,7 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int num // write stat updates if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5) { - for (i = 0;i < MAX_CL_STATS;i++) + for (i = 0;i < MAX_CL_STATS && buf.cursize + 6 + 11 <= buf.maxsize;i++) { if (d->statsdeltabits[i>>3] & (1<<(i&7))) {