Skip to content
Permalink
Browse files Browse the repository at this point in the history
Graphics protocol: Dont return filename in the error message when ope…
…ning file fails, since filenames can contain control characters

Fixes #3128
  • Loading branch information
kovidgoyal committed Nov 29, 2020
1 parent 8845bd6 commit 82c1378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/changelog.rst
Expand Up @@ -26,6 +26,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- 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]
-------------------
Expand Down
2 changes: 1 addition & 1 deletion kitty/graphics.c
Expand Up @@ -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') {
Expand Down

0 comments on commit 82c1378

Please sign in to comment.