From 991177923f5d1ab1ac5b6af03661b102ea44fb3c Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 5 Dec 2018 13:47:25 +0900 Subject: [PATCH] file-browser: fix buffer overflow in filename copy --- apps/file-browser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/file-browser.c b/apps/file-browser.c index 7d801ba1..1f86f45d 100644 --- a/apps/file-browser.c +++ b/apps/file-browser.c @@ -805,7 +805,7 @@ static void _menu_action_copy(struct MenuEntry * entry) { if (!output_size) return; /* Create the clipboard contents as a LF-separated list of absolute paths */ - char * clipboard = malloc(output_size); + char * clipboard = malloc(output_size+1); /* last nil */ clipboard[0] = '\0'; for (int i = 0; i < file_pointers_len; ++i) { if (file_pointers[i]->selected) { @@ -821,6 +821,7 @@ static void _menu_action_copy(struct MenuEntry * entry) { clipboard[output_size-1] = '\0'; } + yutani_set_clipboard(yctx, clipboard); free(clipboard); }