summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-04-23 22:43:09 +0000
committernicm <nicm@openbsd.org>2012-04-23 22:43:09 +0000
commita09004283db561bf21768d25b8d84b2471615192 (patch)
treee8f8866b008e5b40712368a890809631e8b6b646 /usr.bin/tmux/cmd.c
parentUse a helper function to fire choose callback. (diff)
downloadwireguard-openbsd-a09004283db561bf21768d25b8d84b2471615192.tar.xz
wireguard-openbsd-a09004283db561bf21768d25b8d84b2471615192.zip
Do not return a buffer on the stack, mentioned by jsg a while ago.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 5b9ba25de01..3c7c6c64a6e 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.64 2012/04/22 05:24:05 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.65 2012/04/23 22:43:09 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1325,8 +1325,10 @@ find_home:
return (s->cwd);
complete_path:
- if (root[skip] == '\0')
- return (root);
+ if (root[skip] == '\0') {
+ strlcpy(path, root, sizeof path);
+ return (path);
+ }
n = snprintf(path, sizeof path, "%s/%s", root, cwd + skip);
if (n > 0 && (size_t)n < sizeof path)
return (path);