Defense in depth use O_NOFOLLOW when opening regular files

This commit is contained in:
Kovid Goyal 2026-08-23 17:14:06 +05:30
parent 7616cfe854
commit 3c3133d339
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -952,7 +952,7 @@ drop_send_file_chunks(Window *w) {
static bool
drop_send_file_data(Window *w, const char *path) {
drop_close_file_fd(w);
int fd = safe_open(path, O_RDONLY | O_CLOEXEC | O_NONBLOCK, 0);
int fd = safe_open(path, O_RDONLY | O_CLOEXEC | O_NONBLOCK | O_NOFOLLOW, 0);
if (fd < 0) {
switch (errno) {
case ENOENT: