forked from premiere/premiere-libtorrent
fixed potential security problem where files with absolute paths were allowed in torrents
This commit is contained in:
parent
59e66e9c36
commit
4839e509b7
|
@ -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<file_entry>& 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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue