From 82c137878c2b99100a3cdc1c0f0efea069313901 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Nov 2020 12:02:14 +0530 Subject: [PATCH] Graphics protocol: Dont return filename in the error message when opening file fails, since filenames can contain control characters Fixes #3128 --- docs/changelog.rst | 3 +++ kitty/graphics.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index fc67fe43d..45ab3f723 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -26,6 +26,9 @@ To update |kitty|, :doc:`follow the instructions `. - Add an option, :opt:`detect_urls` to control whether kitty will detect URLs when the mouse moves over them (:pull:`3118`) +- Graphics protocol: Dont return filename in the error message when opening file + fails, since filenames can contain control characters (:iss:`3128`) + 0.19.2 [2020-11-13] ------------------- diff --git a/kitty/graphics.c b/kitty/graphics.c index 4671531cb..07e55c080 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -402,7 +402,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_ snprintf(fname, sizeof(fname)/sizeof(fname[0]), "%.*s", (int)g->payload_sz, payload); if (tt == 's') fd = shm_open(fname, O_RDONLY, 0); else fd = open(fname, O_CLOEXEC | O_RDONLY); - if (fd == -1) ABRT(EBADF, "Failed to open file %s for graphics transmission with error: [%d] %s", fname, errno, strerror(errno)); + if (fd == -1) ABRT(EBADF, "Failed to open file for graphics transmission with error: [%d] %s", errno, strerror(errno)); img->data_loaded = mmap_img_file(self, img, fd, g->data_sz, g->data_offset); safe_close(fd, __FILE__, __LINE__); if (tt == 't') {