From f437328ad13ac2bb22f162b9f986aaef9a5482bd Mon Sep 17 00:00:00 2001 From: VallierDev <24893073+VallierDev@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:45:18 +0800 Subject: [PATCH] file_trans: reject send_request without a path instead of walking / Refs #208 Co-Authored-By: Claude Opus 5.5 --- src/file_trans.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/file_trans.rs b/src/file_trans.rs index 7f1b242..17538d9 100644 --- a/src/file_trans.rs +++ b/src/file_trans.rs @@ -568,6 +568,13 @@ impl FileSession { fn send_request(self: &Arc, rid: u64, f: &[WireField]) { let id = TaskId::parse(f); let raw = get_text(f, 2); + // Newer viewers (Windows 4.44.1, #208) send only the task id here; an empty path must not + // become "/" and walk the whole filesystem into a misleading permission error. + if raw.trim().is_empty() { + log::info!("File transfer send_request without path: task={} fields={:?}", id.task, f.iter().map(|x| x.number).collect::>()); + self.respond(rid, 2, Enc::default().msg(1, id.enc()).uint(2, FT_PROTOCOL)); + return; + } let path = normalize(&raw); let collected = collect_download(&path).map_err(|e| io_error(&e)); let mut body = Enc::default().msg(1, id.enc());