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.
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
{
char description[32*64], temp[64];
int count;
- strcpy(description, "packet dump: ");
+ strcpy (description, "packet dump: ");
i = cmdcount - 32;
if (i < 0)
i = 0;
Con_Printf("received server list...\n");
while (length >= 7 && data[0] == '\\' && (data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF || data[4] != 0xFF) && data[5] * 256 + data[6] != 0)
{
- sprintf(ipstring, "%u.%u.%u.%u:%u", data[1], data[2], data[3], data[4], (data[5] << 8) | data[6]);
+ snprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[1], data[2], data[3], data[4], (data[5] << 8) | data[6]);
if (developer.integer)
Con_Printf("Requesting info from server %s\n", ipstring);
LHNETADDRESS_FromString(&svaddress, ipstring, 0);
}
memset(&hostcache[n], 0, sizeof(hostcache[n]));
// store the data the engine cares about (address and ping)
- strcpy(hostcache[n].cname, ipstring);
+ strlcpy (hostcache[n].cname, ipstring, sizeof (hostcache[n].cname));
hostcache[n].ping = 100000;
hostcache[n].querytime = realtime;
// build description strings for the things users care about
{
hostCacheCount++;
memset(&hostcache[n], 0, sizeof(hostcache[n]));
- strcpy(hostcache[n].name, MSG_ReadString());
- strcpy(hostcache[n].map, MSG_ReadString());
+ strlcpy (hostcache[n].name, MSG_ReadString(), sizeof (hostcache[n].name));
+ strlcpy (hostcache[n].map, MSG_ReadString(), sizeof (hostcache[n].map));
hostcache[n].users = MSG_ReadByte();
hostcache[n].maxusers = MSG_ReadByte();
c = MSG_ReadByte();
strcpy(hostcache[n].name, "*");
strlcat (hostcache[n].name, hostcache[n].cname, sizeof(hostcache[n].name));
}
- strcpy(hostcache[n].cname, cname);
+ strlcpy (hostcache[n].cname, cname, sizeof (hostcache[n].cname));
}
}
break;
{
cls.connect_trying = false;
if (m_state == m_slist)
- strcpy(m_return_reason, "Connect: Failed");
+ strcpy (m_return_reason, "Connect: Failed");
else
Con_Printf("Connect failed\n");
return;
if (cls.connect_nextsendtime)
{
if (m_state == m_slist)
- strcpy(m_return_reason, "Connect: Still trying");
+ strcpy (m_return_reason, "Connect: Still trying");
else
Con_Printf("Still trying...\n");
}
else
{
if (m_state == m_slist)
- strcpy(m_return_reason, "Connect: Trying");
+ strcpy (m_return_reason, "Connect: Trying");
else
Con_Printf("Trying...\n");
}
{
// connect to the client
// everything is allocated, just fill in the details
- strcpy(conn->address, addressstring2);
+ strlcpy (conn->address, addressstring2, sizeof (conn->address));
if (developer.integer)
Con_Printf("Datagram_ParseConnectionless: sending CCREP_ACCEPT to %s.\n", addressstring2);
// send back the info about the server connection
client->entitydatabase4 = EntityFrame4_AllocDatabase(sv_clients_mempool);
MSG_WriteByte (&client->message, svc_print);
- sprintf (message, "\002\nServer: %s build %s (progs %i crc)", gamename, buildstring, pr_crc);
+ snprintf (message, sizeof (message), "\002\nServer: %s build %s (progs %i crc)", gamename, buildstring, pr_crc);
MSG_WriteString (&client->message,message);
MSG_WriteByte (&client->message, svc_serverinfo);
memset (&sv, 0, sizeof(sv));
- strcpy (sv.name, server);
+ strlcpy (sv.name, server, sizeof (sv.name));
// load progs to get entity field count
PR_LoadProgs ();
Mod_ClearUsed();
- strcpy (sv.name, server);
- sprintf (sv.modelname,"maps/%s.bsp", server);
+ strlcpy (sv.name, server, sizeof (sv.name));
+ snprintf (sv.modelname, sizeof (sv.modelname), "maps/%s.bsp", server);
sv.worldmodel = Mod_ForName(sv.modelname, false, true, true);
if (!sv.worldmodel)
{
pool->chain = NULL;
pool->totalsize = 0;
pool->realsize = sizeof(mempool_t);
- strcpy(pool->name, name);
+ strlcpy (pool->name, name, sizeof (pool->name));
pool->next = poolchain;
poolchain = pool;
return pool;