Fix several potential security vulnerabilties

Submitted by: Ozkan Sezer
This commit is contained in:
Yamagi Burmeister 2015-08-24 17:58:19 +02:00
parent 5ad7b1e72d
commit a4d0d89720
2 changed files with 10 additions and 3 deletions

View file

@ -903,6 +903,7 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
char weapon_filename[MAX_QPATH];
Q_strlcpy(ci->cinfo, s, sizeof(ci->cinfo));
s = ci->cinfo;
/* isolate the player's name */
Q_strlcpy(ci->name, s, sizeof(ci->name));
@ -1048,7 +1049,7 @@ CL_ParseClientinfo(int player)
void
CL_ParseConfigString(void)
{
int i;
int i, length;
char *s;
char olds[MAX_QPATH];
@ -1063,6 +1064,12 @@ CL_ParseConfigString(void)
Q_strlcpy(olds, cl.configstrings[i], sizeof(olds));
length = strlen(s);
if (length > sizeof(cl.configstrings) - sizeof(cl.configstrings[0])*i - 1)
{
Com_Error(ERR_DROP, "CL_ParseConfigString: oversize configstring");
}
strcpy(cl.configstrings[i], s);
/* do something apropriate */

View file

@ -902,7 +902,7 @@ MSG_ReadString(sizebuf_t *msg_read)
do
{
c = MSG_ReadChar(msg_read);
c = MSG_ReadByte(msg_read);
if ((c == -1) || (c == 0))
{
@ -929,7 +929,7 @@ MSG_ReadStringLine(sizebuf_t *msg_read)
do
{
c = MSG_ReadChar(msg_read);
c = MSG_ReadByte(msg_read);
if ((c == -1) || (c == 0) || (c == '\n'))
{