if (com_token[0] == '}')
break; // end of worldspawn
if (com_token[0] == '_')
- strcpy(key, com_token + 1);
+ strlcpy (key, com_token + 1, sizeof (key));
else
- strcpy(key, com_token);
+ strlcpy (key, com_token, sizeof (key));
while (key[strlen(key)-1] == ' ') // remove trailing spaces
key[strlen(key)-1] = 0;
if (!COM_ParseToken(&data, false))
return; // error
- strcpy(value, com_token);
+ strlcpy (value, com_token, sizeof (value));
if (!strcmp("sky", key))
R_SetSkyBox(value);
else if (!strcmp("skyname", key)) // non-standard, introduced by QuakeForge... sigh.
// parse signon message
str = MSG_ReadString ();
- strncpy (cl.levelname, str, sizeof(cl.levelname)-1);
+ strlcpy (cl.levelname, str, sizeof(cl.levelname));
// seperate the printfs so the server message can have a color
if (cl.protocol != PROTOCOL_NEHAHRAMOVIE) // no messages when playing the Nehahra movie
Host_Error ("Server sent too many model precaches\n");
if (strlen(str) >= MAX_QPATH)
Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1);
- strcpy(parse_model_precache[nummodels], str);
+ strlcpy (parse_model_precache[nummodels], str, sizeof (parse_model_precache[nummodels]));
}
// parse sound precache list
for (numsounds=1 ; ; numsounds++)
Host_Error("Server sent too many sound precaches\n");
if (strlen(str) >= MAX_QPATH)
Host_Error("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1);
- strcpy(parse_sound_precache[numsounds], str);
+ strlcpy (parse_sound_precache[numsounds], str, sizeof (parse_sound_precache[numsounds]));
}
// touch all of the precached models that are still loaded so we can free
cl.stats[STAT_CELLS] = MSG_ReadByte();
i = MSG_ReadByte ();
- if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE || gamemode == GAME_NEXUIZ)
+
+ if (gamemode == GAME_HIPNOTIC || gamemode == GAME_ROGUE)
i = (1<<i);
// GAME_NEXUIZ hud needs weapon change time
+ // GAME_NEXUIZ uses a bit number as it's STAT_ACTIVEWEAPON, not a bitfield
+ // like other modes
if (cl.stats[STAT_ACTIVEWEAPON] != i)
cl.weapontime = cl.time;
cl.stats[STAT_ACTIVEWEAPON] = i;
{
char description[32*64], temp[64];
int count;
- strcpy(description, "packet dump: ");
+ strcpy (description, "packet dump: ");
i = cmdcount - 32;
if (i < 0)
i = 0;
i &= 31;
while(count > 0)
{
- sprintf(temp, "%3i:%s ", cmdlog[i], cmdlogname[i]);
- strcat(description, temp);
+ snprintf (temp, sizeof (temp), "%3i:%s ", cmdlog[i], cmdlogname[i]);
+ strlcat (description, temp, sizeof (description));
count--;
i++;
i &= 31;
i = MSG_ReadByte ();
if (i >= MAX_LIGHTSTYLES)
Host_Error ("svc_lightstyle >= MAX_LIGHTSTYLES");
- strncpy (cl_lightstyle[i].map, MSG_ReadString(), MAX_STYLESTRING - 1);
+ strlcpy (cl_lightstyle[i].map, MSG_ReadString(), sizeof (cl_lightstyle[i].map));
cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
break;
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatename >= cl.maxclients");
- strcpy (cl.scores[i].name, MSG_ReadString ());
+ strlcpy (cl.scores[i].name, MSG_ReadString (), sizeof (cl.scores[i].name));
break;
case svc_updatefrags: