diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-07-10 23:02:12 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-07-10 23:02:12 +0100 |
commit | 726496b1711117d113b8da971edf8114db07ab06 (patch) | |
tree | beb1e13d95eadbbe22bb02ea0b42e9e62a211890 | |
parent | e413787a5dbf0b4e377935d2192bc00cf9830cb8 (diff) |
Include the file extension when checking for log filename length.
-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; } |