Skip to content

Commit 82c1378

Browse files
committed
Graphics protocol: Dont return filename in the error message when opening file fails, since filenames can contain control characters
Fixes #3128
1 parent 8845bd6 commit 82c1378

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: docs/changelog.rst

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
2626
- Add an option, :opt:`detect_urls` to control whether kitty will detect URLs
2727
when the mouse moves over them (:pull:`3118`)
2828

29+
- Graphics protocol: Dont return filename in the error message when opening file
30+
fails, since filenames can contain control characters (:iss:`3128`)
31+
2932

3033
0.19.2 [2020-11-13]
3134
-------------------

Diff for: kitty/graphics.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_
402402
snprintf(fname, sizeof(fname)/sizeof(fname[0]), "%.*s", (int)g->payload_sz, payload);
403403
if (tt == 's') fd = shm_open(fname, O_RDONLY, 0);
404404
else fd = open(fname, O_CLOEXEC | O_RDONLY);
405-
if (fd == -1) ABRT(EBADF, "Failed to open file %s for graphics transmission with error: [%d] %s", fname, errno, strerror(errno));
405+
if (fd == -1) ABRT(EBADF, "Failed to open file for graphics transmission with error: [%d] %s", errno, strerror(errno));
406406
img->data_loaded = mmap_img_file(self, img, fd, g->data_sz, g->data_offset);
407407
safe_close(fd, __FILE__, __LINE__);
408408
if (tt == 't') {

0 commit comments

Comments
 (0)