mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
- make nails, soundlist, and modellist return NET_ERROR when there's
too many items in the block
This commit is contained in:
parent
c19c237e0e
commit
f9ab09356e
1 changed files with 7 additions and 6 deletions
|
@ -345,7 +345,7 @@ NET_SVC_Nails_Parse (net_svc_nails_t *block, msg_t *msg)
|
||||||
bits[j] = MSG_ReadByte (msg);
|
bits[j] = MSG_ReadByte (msg);
|
||||||
|
|
||||||
if (i >= MAX_PROJECTILES)
|
if (i >= MAX_PROJECTILES)
|
||||||
continue;
|
return NET_ERROR;
|
||||||
|
|
||||||
// [48 bits] xyzpy 12 12 12 4 8
|
// [48 bits] xyzpy 12 12 12 4 8
|
||||||
// format is 12 bits per origin coord, 4 for angles[0],
|
// format is 12 bits per origin coord, 4 for angles[0],
|
||||||
|
@ -358,9 +358,6 @@ NET_SVC_Nails_Parse (net_svc_nails_t *block, msg_t *msg)
|
||||||
block->nails[i].angles[2] = 0;
|
block->nails[i].angles[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block->numnails > MAX_PROJECTILES)
|
|
||||||
block->numnails = MAX_PROJECTILES;
|
|
||||||
|
|
||||||
return msg->badread;
|
return msg->badread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,10 +368,12 @@ NET_SVC_Modellist_Parse (net_svc_modellist_t *block, msg_t *msg)
|
||||||
|
|
||||||
block->startmodel = MSG_ReadByte (msg);
|
block->startmodel = MSG_ReadByte (msg);
|
||||||
|
|
||||||
for (i = 0; i < MAX_MODELS; i++) {
|
for (i = 0;; i++) {
|
||||||
block->models[i] = MSG_ReadString (msg);
|
block->models[i] = MSG_ReadString (msg);
|
||||||
if (!*block->models[i])
|
if (!*block->models[i])
|
||||||
break;
|
break;
|
||||||
|
if (i >= MAX_MODELS)
|
||||||
|
return NET_ERROR;
|
||||||
}
|
}
|
||||||
// this is a bit redundant, but I think the robustness is a good thing
|
// this is a bit redundant, but I think the robustness is a good thing
|
||||||
block->models[MAX_MODELS] = "";
|
block->models[MAX_MODELS] = "";
|
||||||
|
@ -391,10 +390,12 @@ NET_SVC_Soundlist_Parse (net_svc_soundlist_t *block, msg_t *msg)
|
||||||
|
|
||||||
block->startsound = MSG_ReadByte (msg);
|
block->startsound = MSG_ReadByte (msg);
|
||||||
|
|
||||||
for (i = 0; i < MAX_MODELS; i++) {
|
for (i = 0;; i++) {
|
||||||
block->sounds[i] = MSG_ReadString (msg);
|
block->sounds[i] = MSG_ReadString (msg);
|
||||||
if (!*block->sounds[i])
|
if (!*block->sounds[i])
|
||||||
break;
|
break;
|
||||||
|
if (i >= MAX_SOUNDS)
|
||||||
|
return NET_ERROR;
|
||||||
}
|
}
|
||||||
// this is a bit redundant, but I think the robustness is a good thing
|
// this is a bit redundant, but I think the robustness is a good thing
|
||||||
block->sounds[MAX_SOUNDS] = "";
|
block->sounds[MAX_SOUNDS] = "";
|
||||||
|
|
Loading…
Reference in a new issue