summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-26 11:48:08 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-26 11:48:08 +0000
commit3f7de477a8db7f6c017dd8a644824650d71d1074 (patch)
treecd3c0de5a3a6b1fe3397798c9e0d3d5b7031dccd
parent955ee9d4d08d3b2dbcdab41ae4a1e8a5d4863ba2 (diff)
Buffer name can be NULL, check before strdup().
-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);