mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Fix some strncat issues.
This commit is contained in:
parent
8f028b8a0d
commit
1eb1622420
1 changed files with 14 additions and 14 deletions
|
@ -850,7 +850,7 @@ Key_In_Bind_f (void)
|
|||
{
|
||||
int c, i;
|
||||
const char *imt, *key, *cmd = 0;
|
||||
char cmd_buf[1024];
|
||||
dstring_t *cmd_buf = 0;
|
||||
|
||||
c = Cmd_Argc ();
|
||||
|
||||
|
@ -865,17 +865,17 @@ Key_In_Bind_f (void)
|
|||
key = Cmd_Argv (2);
|
||||
|
||||
if (c >= 4) {
|
||||
cmd = cmd_buf;
|
||||
cmd_buf[0] = 0;
|
||||
cmd_buf = dstring_newstr ();
|
||||
for (i = 3; i < c; i++) {
|
||||
strncat (cmd_buf, Cmd_Argv (i), sizeof (cmd_buf) -
|
||||
strlen (cmd_buf));
|
||||
if (i != (c - 1))
|
||||
strncat (cmd_buf, " ", sizeof (cmd_buf) - strlen (cmd_buf));
|
||||
dasprintf (cmd_buf, "%s%s", i > 3 ? " " : "", Cmd_Argv (i));
|
||||
}
|
||||
cmd = cmd_buf->str;
|
||||
}
|
||||
|
||||
Key_In_Bind (imt, key, cmd);
|
||||
if (cmd_buf) {
|
||||
dstring_delete (cmd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -896,7 +896,7 @@ Key_Bind_f (void)
|
|||
{
|
||||
int c, i;
|
||||
const char *key, *cmd = 0;
|
||||
char cmd_buf[1024];
|
||||
dstring_t *cmd_buf = 0;
|
||||
|
||||
c = Cmd_Argc ();
|
||||
|
||||
|
@ -908,17 +908,17 @@ Key_Bind_f (void)
|
|||
key = OK_TranslateKeyName (Cmd_Argv (1));
|
||||
|
||||
if (c >= 3) {
|
||||
cmd = cmd_buf;
|
||||
cmd_buf[0] = 0;
|
||||
cmd_buf = dstring_newstr ();
|
||||
for (i = 2; i < c; i++) {
|
||||
strncat (cmd_buf, Cmd_Argv (i), sizeof (cmd_buf) -
|
||||
strlen (cmd_buf));
|
||||
if (i != (c - 1))
|
||||
strncat (cmd_buf, " ", sizeof (cmd_buf) - strlen (cmd_buf));
|
||||
dasprintf (cmd_buf, "%s%s", i > 2 ? " " : "", Cmd_Argv (i));
|
||||
}
|
||||
cmd = cmd_buf->str;
|
||||
}
|
||||
|
||||
Key_In_Bind ("imt_mod", key, cmd);
|
||||
if (cmd_buf) {
|
||||
dstring_delete (cmd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue