@@ -2785,7+2775,7 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
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;
@@ -2795,7+2785,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
space = strchr(line + 1, ' ');
if(space && pos == (space - line) + 1)
{
- strlcpy(command, line + 1, min(sizeof(command), (unsigned int)(space - line)));
+ // adding 1 to line drops the leading ]
+ dp_ustr2stp(command, sizeof(command), line + 1, space - (line + 1));
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)
@@ -2812,8+2803,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
// 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))
@@ -2861,8+2852,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
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
@@ -2884,8+2875,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
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
@@ -2944,7+2935,7 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
// of resultbuf.strings[0]. We want to append the characters
// from resultbuf.strings[0] to (not including) p as these are