summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-load-buffer.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-10-26 11:48:07 +0000
committernicm <nicm@openbsd.org>2016-10-26 11:48:07 +0000
commitf9fb68b59660f4e0899b73a3236a6efdbcd036c1 (patch)
tree55e9f86f80453e5789c39c853e56793ba1cf95b8 /usr.bin/tmux/cmd-load-buffer.c
parentuse -ffloat-store to avoid too much precision which breaks the subtle test (diff)
downloadwireguard-openbsd-f9fb68b59660f4e0899b73a3236a6efdbcd036c1.tar.xz
wireguard-openbsd-f9fb68b59660f4e0899b73a3236a6efdbcd036c1.zip
Buffer name can be NULL, check before strdup().
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index ab9fd22aa1e..a7ea1cc2531 100644
--- a/usr.bin/tmux/cmd-load-buffer.c
+++ b/usr.bin/tmux/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-load-buffer.c,v 1.46 2016/10/16 19:04:05 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.47 2016/10/26 11:48:07 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -73,7 +73,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
if (strcmp(path, "-") == 0) {
cdata = xcalloc(1, sizeof *cdata);
cdata->item = item;
- cdata->bufname = xstrdup(bufname);
+
+ if (bufname != NULL)
+ cdata->bufname = xstrdup(bufname);
error = server_set_stdin_callback(c, cmd_load_buffer_callback,
cdata, &cause);