Sanitize network name for scrollback files

This prevents using invalid chars on Windows or creating directories
This commit is contained in:
Patrick Griffis 2016-09-11 15:49:06 -04:00
parent 910851e04d
commit 15600f405f

View File

@ -79,6 +79,7 @@ scrollback_get_filename (session *sess)
if (!net) if (!net)
return NULL; return NULL;
net = log_create_filename (net);
buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, ""); buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, "");
mkdir_p (buf); mkdir_p (buf);
g_free (buf); g_free (buf);
@ -89,6 +90,7 @@ scrollback_get_filename (session *sess)
else else
buf = NULL; buf = NULL;
g_free (chan); g_free (chan);
g_free (net);
if (buf) if (buf)
{ {