static char copybuf[MAX_INPUTLINE]; // client only
con_lineinfo_t *l = &CONBUFFER_LINES(buf, i);
size_t sz = l->len+1 > sizeof(copybuf) ? sizeof(copybuf) : l->len+1;
- strlcpy(copybuf, l->start, sz);
+ dp_strlcpy(copybuf, l->start, sz);
return copybuf;
}
logfile = FS_OpenRealFile(log_file.string, "a", false);
if (logfile != NULL)
{
- strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
+ dp_strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
FS_Print (logfile, Log_Timestamp ("Log started"));
}
}
{
// empty prefix because ] is part of the console edit line
prefix = "";
- strlcpy(text, key_line, sizeof(text));
+ dp_strlcpy(text, key_line, sizeof(text));
linepos = key_linepos;
fnt = FONT_CONSOLE;
}
prefix = "say_team:";
else
prefix = "say:";
- strlcpy(text, chat_buffer, sizeof(text));
+ dp_strlcpy(text, chat_buffer, sizeof(text));
linepos = chat_bufferpos;
fnt = FONT_CHAT;
}
char entfilename[MAX_QPATH];
char desc[64];
desc[0] = 0;
- strlcpy(message, "^1ERROR: open failed^7", sizeof(message));
+ dp_strlcpy(message, "^1ERROR: open failed^7", sizeof(message));
p = 0;
f = FS_OpenVirtualFile(t->filenames[i], true);
if(f)
{
- strlcpy(message, "^1ERROR: not a known map format^7", sizeof(message));
+ dp_strlcpy(message, "^1ERROR: not a known map format^7", sizeof(message));
memset(buf, 0, 1024);
FS_Read(f, buf, 1024);
if (!memcmp(buf, "IBSP", 4))
}
else
dpsnprintf(desc, sizeof(desc), "unknown%i", BuffLittleLong(buf));
- strlcpy(entfilename, t->filenames[i], sizeof(entfilename));
+ dp_strlcpy(entfilename, t->filenames[i], sizeof(entfilename));
memcpy(entfilename + strlen(entfilename) - 4, ".ent", 5);
entities = (char *)FS_LoadFile(entfilename, tempmempool, true, NULL);
if (!entities && lumplen >= 10)
if (!strcmp(keyname, "message"))
{
// get the message contents
- strlcpy(message, com_token, sizeof(message));
+ dp_strlcpy(message, com_token, sizeof(message));
break;
}
}
if(match < 0)
continue;
//Con_Printf("Possible match: %s|%s\n", cl.scores[p].name, name);
- strlcpy(Nicks_list[count], cl.scores[p].name, sizeof(Nicks_list[count]));
+ dp_strlcpy(Nicks_list[count], cl.scores[p].name, sizeof(Nicks_list[count]));
// the sanitized list
- strlcpy(Nicks_sanlist[count], name, sizeof(Nicks_sanlist[count]));
+ dp_strlcpy(Nicks_sanlist[count], name, sizeof(Nicks_sanlist[count]));
if(!count)
{
Nicks_matchpos = match;
if(Nicks_strcleanlen(Nicks_sanlist[0]) < strlen(tempstr))
{
// if the clean sanitized one is longer than the current one, use it, it has crap chars which definitely are in there
- strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0]));
+ dp_strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0]));
}
}
if(Nicks_strcleanlen(Nicks_sanlist[0]) < strlen(tempstr))
{
// if the clean sanitized one is longer than the current one, use it, it has crap chars which definitely are in there
- strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0]));
+ dp_strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0]));
}
}
pos++;
s = line + pos;
- strlcpy(s2, line + linepos, sizeof(s2)); //save chars after cursor
+ dp_strlcpy(s2, line + linepos, sizeof(s2)); //save chars after cursor
line[linepos] = 0; //hide them
c = v = a = n = cmd_len = 0;
space = strchr(line + 1, ' ');
if(space && pos == (space - line) + 1)
{
- strlcpy(command, line + 1, min(sizeof(command), (unsigned int)(space - line)));
+ dp_strlcpy(command, line + 1, min(sizeof(command), (unsigned int)(space - line)));
patterns = Cvar_VariableString(cmd->cvars, va(vabuf, sizeof(vabuf), "con_completion_%s", command), CF_CLIENT | CF_SERVER); // TODO maybe use a better place for this?
if(patterns && !*patterns)
// and now do the actual work
*s = 0;
- strlcat(line, t, MAX_INPUTLINE);
- strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
+ dp_strlcat(line, t, MAX_INPUTLINE);
+ dp_strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
// and fix the cursor
if(linepos > (int) strlen(line))
const char *slash = strrchr(s, '/');
if(slash)
{
- strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
- strlcat(t, com_token, sizeof(t));
+ dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
+ dp_strlcat(t, com_token, sizeof(t));
search = FS_Search(t, true, true, NULL);
}
else
const char *slash = strrchr(s, '/');
if(slash)
{
- strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
- strlcat(t, "*", sizeof(t));
+ dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
+ dp_strlcat(t, "*", sizeof(t));
search = FS_Search(t, true, true, NULL);
}
else
// of resultbuf.strings[0]. We want to append the characters
// from resultbuf.strings[0] to (not including) p as these are
// the unique prefix
- strlcpy(t, (resultbuf.numstrings > 0 ? resultbuf : dirbuf).strings[0], min(matchchars + 1, sizeof(t)));
+ dp_strlcpy(t, (resultbuf.numstrings > 0 ? resultbuf : dirbuf).strings[0], min(matchchars + 1, sizeof(t)));
}
// first move the cursor
// and now do the actual work
*s = 0;
- strlcat(line, t, MAX_INPUTLINE);
- strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
+ dp_strlcat(line, t, MAX_INPUTLINE);
+ dp_strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
// and fix the cursor
if(linepos > (int) strlen(line))
if (!(c + v + a + n)) // No possible matches
{
if(s2[0])
- strlcpy(&line[linepos], s2, linesize - linepos);
+ dp_strlcpy(&line[linepos], s2, linesize - linepos);
return linepos;
}
// use strlcat to avoid a buffer overrun
line[linepos] = 0;
- strlcat(line, s2, linesize);
+ dp_strlcat(line, s2, linesize);
if (!is_console)
return linepos;