diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-05-15 15:34:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-05-15 15:34:10 +0000 |
commit | 17ae6a19afcad6d87d179fe33c7e456e656eb4e2 (patch) | |
tree | 494656d8c4485cf1be4feca38a8fb04d15d65ed8 | |
parent | bcd9e88369a1e0fb3b93b6258e788a5de09fb130 (diff) |
Reserve space for \0 in cmd_print, from George Nachman.
-rw-r--r-- | usr.bin/tmux/cmd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index b92b61a771c..000e2ee7210 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.84 2013/03/25 11:53:54 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.85 2013/05/15 15:34:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -295,8 +295,8 @@ cmd_print(struct cmd *cmd, char *buf, size_t len) size_t off, used; off = xsnprintf(buf, len, "%s ", cmd->entry->name); - if (off < len) { - used = args_print(cmd->args, buf + off, len - off); + if (off + 1 < len) { + used = args_print(cmd->args, buf + off, len - off - 1); if (used == 0) off--; else |