From abea17afd9e85d88a14be0222d094c37ef7975b6 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 26 Oct 2016 11:48:07 +0000 Subject: [PATCH] Buffer name can be NULL, check before strdup(). --- cmd-load-buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index 2484bb66..8592ed39 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -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);