From f61bde7d3cd6932829f5537527942c6193fe6dcd Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 18 Dec 2000 17:15:14 +0000 Subject: [PATCH] Autologging: '/' -> '_' - don't even accidentally try to log to #../../../file if you happen to join to such channel.. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1009 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/fe-log.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c index 319bc85c..676b9af2 100644 --- a/src/fe-common/core/fe-log.c +++ b/src/fe-common/core/fe-log.c @@ -342,7 +342,7 @@ static void autologs_close_all(void) static void autolog_open(void *server, const char *target) { LOG_REC *log; - char *fname, *dir; + char *fname, *dir, *fixed_target; log = logs_find_item(LOG_ITEM_TARGET, target, server, NULL); if (log != NULL && !log->failed) { @@ -350,8 +350,14 @@ static void autolog_open(void *server, const char *target) return; } + /* '/' -> '_' - don't even accidentally try to log to + #../../../file if you happen to join to such channel.. */ + fixed_target = g_strdup(target); + replace_chars(fixed_target, '/', '_'); fname = parse_special_string(autolog_path, server, NULL, - target, NULL, 0); + fixed_target, NULL, 0); + g_free(fixed_target); + if (log_find(fname) == NULL) { log = log_create_rec(fname, autolog_level); log_item_add(log, LOG_ITEM_TARGET, target, server);