From 4839e509b744addc7ec973c26aa1eebd92a0b338 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 24 Feb 2005 06:51:59 +0000 Subject: [PATCH] fixed potential security problem where files with absolute paths were allowed in torrents --- src/torrent_info.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 4524854f5..241899f84 100755 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -72,6 +72,9 @@ namespace { target.path /= i->string(); } + if (target.path.is_complete()) throw std::runtime_error("torrent contains " + "a file with an absolute path: '" + + target.path.native_file_string() + "'"); } void extract_files(const entry::list_type& list, std::vector& target) @@ -187,6 +190,8 @@ namespace libtorrent // field. file_entry e; e.path = m_name; + if (e.path.is_complete()) throw std::runtime_error("torrent contains " + "a file with an absolute path: '" + e.path.native_file_string() + "'"); e.size = info["length"].integer(); m_files.push_back(e); }