Do not allow rename-session to introduce '/' in session names

This commit is contained in:
Maxime Coste 2017-11-06 11:55:56 +08:00
parent 4a00807ad9
commit 0a081b9f31

View File

@ -808,6 +808,9 @@ Server::Server(String session_name)
bool Server::rename_session(StringView name) bool Server::rename_session(StringView name)
{ {
if (contains(name, '/'))
throw runtime_error{"Cannot create sessions with '/' in their name"};
String old_socket_file = format("{}/kakoune/{}/{}", tmpdir(), String old_socket_file = format("{}/kakoune/{}/{}", tmpdir(),
getpwuid(geteuid())->pw_name, m_session); getpwuid(geteuid())->pw_name, m_session);
String new_socket_file = format("{}/kakoune/{}/{}", tmpdir(), String new_socket_file = format("{}/kakoune/{}/{}", tmpdir(),