// currently 44 bytes, longest possible IPv6 address: 39 bytes, so this works
// (if v6 address contains port, it must start with '[')
{
- strlcpy(favorites_idfp[nFavorites_idfp], com_token, sizeof(favorites_idfp[nFavorites_idfp]));
+ dp_strlcpy(favorites_idfp[nFavorites_idfp], com_token, sizeof(favorites_idfp[nFavorites_idfp]));
++nFavorites_idfp;
}
else
CL_Disconnect();
// allocate a net connection to keep track of things
cls.netcon = NetConn_Open(mysocket, peeraddress);
- strlcpy(cl_connect_status, "Connection established", sizeof(cl_connect_status));
+ dp_strlcpy(cl_connect_status, "Connection established", sizeof(cl_connect_status));
crypto = &cls.netcon->crypto;
if(cls.crypto.authenticated)
{
entry = &serverlist_cache[n];
memset(entry, 0, sizeof(*entry));
- strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname));
+ dp_strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname));
// use the broadcast as the first query, NetConn_QueryQueueFrame() will send more
entry->querytime = masterquerytime;
entry = &serverlist_cache[n];
memset(entry, 0, sizeof(*entry));
entry->protocol = protocol;
- strlcpy(entry->info.cname, ipstring, sizeof(entry->info.cname));
+ dp_strlcpy(entry->info.cname, ipstring, sizeof(entry->info.cname));
entry->info.isfavorite = isfavorite;
serverlist_cachecount++;
{
int k;
buf[45] = ' ';
- strlcpy(buf + 46, argbuf, sizeof(buf) - 46);
+ dp_strlcpy(buf + 46, argbuf, sizeof(buf) - 46);
NetConn_Write(mysocket, buf, 46 + (int)strlen(buf + 46), peeraddress);
cls.rcon_commands[i][0] = 0;
--cls.rcon_trying;
return true;
}
Con_DPrintf("\"%s\" received, sending connect request back to %s\n", string, addressstring2);
- strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
+ dp_strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
Protocol_Names(protocolnames, sizeof(protocolnames));
// update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
else
Con_Printf("statusResponse without players block?\n");
- if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
- if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
- if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
- if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
+ if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->game, s, sizeof (info->game));
+ if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod ));
+ if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map ));
+ if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name));
if ((s = InfoString_GetValue(string, "protocol" , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
if ((s = InfoString_GetValue(string, "clients" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
if ((s = InfoString_GetValue(string, "bots" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
if ((s = InfoString_GetValue(string, "gameversion" , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
- if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
- if (p != NULL) strlcpy(info->players, p, sizeof(info->players));
+ if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
+ if (p != NULL) dp_strlcpy(info->players, p, sizeof(info->players));
info->numhumans = info->numplayers - max(0, info->numbots);
info->freeslots = info->maxplayers - info->numplayers;
info->maxplayers = 0;
info->gameversion = 0;
- if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
- if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
- if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
- if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
+ if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->game, s, sizeof (info->game));
+ if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod ));
+ if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map ));
+ if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name));
if ((s = InfoString_GetValue(string, "protocol" , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
if ((s = InfoString_GetValue(string, "clients" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
if ((s = InfoString_GetValue(string, "bots" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
if ((s = InfoString_GetValue(string, "gameversion" , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
- if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
+ if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
info->numhumans = info->numplayers - max(0, info->numbots);
info->freeslots = info->maxplayers - info->numplayers;
return true;
}
Con_DPrintf("challenge %s received, sending QuakeWorld connect request back to %s\n", string + 1, addressstring2);
- strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
+ dp_strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
cls.qw_qport = qport.integer;
// update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
return true;
info = &serverlist_cache[n].info;
- strlcpy(info->game, "QuakeWorld", sizeof(info->game));
- if ((s = InfoString_GetValue(string, "*gamedir" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));else info->mod[0] = 0;
- if ((s = InfoString_GetValue(string, "map" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));else info->map[0] = 0;
- if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));else info->name[0] = 0;
+ dp_strlcpy(info->game, "QuakeWorld", sizeof(info->game));
+ if ((s = InfoString_GetValue(string, "*gamedir" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod ));else info->mod[0] = 0;
+ if ((s = InfoString_GetValue(string, "map" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map ));else info->map[0] = 0;
+ if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name));else info->name[0] = 0;
info->protocol = 0;
info->numplayers = 0; // updated below
info->numhumans = 0; // updated below
break;
info = &serverlist_cache[n].info;
- strlcpy(info->game, "Quake", sizeof(info->game));
- strlcpy(info->mod , "", sizeof(info->mod)); // mod name is not specified
- strlcpy(info->name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->name));
- strlcpy(info->map , MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->map));
+ dp_strlcpy(info->game, "Quake", sizeof(info->game));
+ dp_strlcpy(info->mod , "", sizeof(info->mod)); // mod name is not specified
+ dp_strlcpy(info->name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->name));
+ dp_strlcpy(info->map , MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->map));
info->numplayers = MSG_ReadByte(&cl_message);
info->maxplayers = MSG_ReadByte(&cl_message);
info->protocol = MSG_ReadByte(&cl_message);
cls.connect_trying = false;
LHNETADDRESS_ToString(&cls.connect_address, address, sizeof(address), true);
- strlcpy(cl_connect_status, "Connect: failed, no reply", sizeof(cl_connect_status));
+ dp_strlcpy(cl_connect_status, "Connect: failed, no reply", sizeof(cl_connect_status));
Con_Printf(CON_ERROR "%s from %s\n", cl_connect_status, address);
return;
}
if (IS_NEXUIZ_DERIVED(gamemode) && (teamplay.integer > 0))
{
if(client->frags == -666) // spectator
- strlcpy(teambuf, " 0", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 0", sizeof(teambuf));
else if(client->colors == 0x44) // red team
- strlcpy(teambuf, " 1", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 1", sizeof(teambuf));
else if(client->colors == 0xDD) // blue team
- strlcpy(teambuf, " 2", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 2", sizeof(teambuf));
else if(client->colors == 0xCC) // yellow team
- strlcpy(teambuf, " 3", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 3", sizeof(teambuf));
else if(client->colors == 0x99) // pink team
- strlcpy(teambuf, " 4", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 4", sizeof(teambuf));
else
- strlcpy(teambuf, " 0", sizeof(teambuf));
+ dp_strlcpy(teambuf, " 0", sizeof(teambuf));
}
else
*teambuf = 0;
while((userpass_end = strchr(userpass_start, ' ')))
{
have_usernames = true;
- strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1));
+ dp_strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1));
if(buf[0]) // Ignore empty entries due to leading/duplicate space.
if(comparator(peeraddress, buf, password, cs, cslen))
goto allow;
while((userpass_end = strchr(userpass_start, ' ')))
{
have_usernames = true;
- strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1));
+ dp_strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1));
if(buf[0]) // Ignore empty entries due to leading/duplicate space.
if(comparator(peeraddress, buf, password, cs, cslen))
goto check;
{
// connect to the client
// everything is allocated, just fill in the details
- strlcpy (conn->address, addressstring2, sizeof (conn->address));
+ dp_strlcpy (conn->address, addressstring2, sizeof (conn->address));
if (developer_extra.integer)
Con_DPrintf("Datagram_ParseConnectionless: sending CCREP_ACCEPT to %s.\n", addressstring2);
// send back the info about the server connection
char *s;
char *endpos;
const char *userlevel;
- strlcpy(password, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(password));
- strlcpy(cmd, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(cmd));
+ dp_strlcpy(password, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(password));
+ dp_strlcpy(cmd, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(cmd));
s = cmd;
endpos = cmd + strlen(cmd) + 1; // one behind the NUL, so adding strlen+1 will eventually reach it
userlevel = RCon_Authenticate(peeraddress, password, s, endpos, plaintext_matching, NULL, 0);
if (!masterquerycount)
{
Con_Print(CON_ERROR "Unable to query master servers, no suitable network sockets active.\n");
- strlcpy(cl_connect_status, "No network", sizeof(cl_connect_status));
+ dp_strlcpy(cl_connect_status, "No network", sizeof(cl_connect_status));
}
}
#endif