summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-05-15 15:34:09 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-05-15 15:34:09 +0000
commit25c430b1cd25d64c52d1c14834957abfaaeb69b6 (patch)
tree2676cbd55c751097fb700504de02030aea019b2c /cmd.c
parent772d61f3ed762a50ea4436b7fb70e7024674e6c6 (diff)
Reserve space for \0 in cmd_print, from George Nachman.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index d0348704..e7290f26 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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