From 17e0735f00cb0f5effda63844a3b0d4b58eae0a7 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 9 Oct 2026 12:40:27 +0000 Subject: fix open() follow link vulnerability (O_NOFOLLOW) --- src/history.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/history.cc b/src/history.cc index 5ba33ea..5394835 100644 --- a/src/history.cc +++ b/src/history.cc @@ -70,7 +70,7 @@ void save_history(const string &path) * So we just write to a temp file, and rename it to replace the "real" history file */ string tmp_path = path + ".tmp"; - int fd = open(tmp_path.c_str(), (O_WRONLY | O_CREAT | O_TRUNC), (S_IRUSR | S_IWUSR)); + int fd = open(tmp_path.c_str(), (O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW), (S_IRUSR | S_IWUSR)); if (fd == -1) { loggerln("save_history: fail to open() history"); -- cgit v1.3.1-4-g156e