mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
make all the multi-byte MSG_Read* functions update msg->readcount when the
end of the buffer is hit so subsequent MSG_Read* calls for smaller values error as well. Also add a check for badread in MSG_ReadFloat
This commit is contained in:
parent
ece4e5c6ef
commit
1b1955551a
1 changed files with 8 additions and 0 deletions
|
@ -201,6 +201,7 @@ MSG_ReadShort (msg_t *msg)
|
|||
int c;
|
||||
|
||||
if (msg->readcount + 2 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
@ -219,6 +220,7 @@ MSG_ReadLong (msg_t *msg)
|
|||
int c;
|
||||
|
||||
if (msg->readcount + 4 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
@ -242,6 +244,12 @@ MSG_ReadFloat (msg_t *msg)
|
|||
int l;
|
||||
} dat;
|
||||
|
||||
if (msg->readcount + 4 > msg->message->cursize) {
|
||||
msg->readcount = msg->message->cursize;
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
dat.b[0] = msg->message->data[msg->readcount];
|
||||
dat.b[1] = msg->message->data[msg->readcount + 1];
|
||||
dat.b[2] = msg->message->data[msg->readcount + 2];
|
||||
|
|
Loading…
Reference in a new issue