diff options
-rw-r--r-- | logging.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -84,8 +84,8 @@ int logline(char *str, char *ournick, char *basedir, int type) { // Remove unsafe characters (assuming POSIX, just strip "/" and replace with "_") replacechar(from, '/', '_'); replacechar(to, '/', '_'); - // Ensure filename wouldn't be too long - if (strlen(from) > NAME_MAX || strlen(to) > NAME_MAX) { + // Ensure filename wouldn't be too long (+ 4 for ".log") + if (strlen(from) + 4 > NAME_MAX || strlen(to) + 4 > NAME_MAX) { debugprint(DEBUG_CRIT, "Filename would be too long if logging either '%s' or '%s', returning!\n", from, to); return 0; } |