From 3f7de477a8db7f6c017dd8a644824650d71d1074 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 26 Oct 2016 11:48:08 +0000 Subject: Buffer name can be NULL, check before strdup(). --- usr.bin/tmux/cmd-load-buffer.c | 6 ++++-- 1 file 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 @@ -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); -- cgit v1.2.3