summaryrefslogtreecommitdiff
path: root/logging.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2021-01-19 00:12:11 +0000
committerLuke Bratch <luke@bratch.co.uk>2021-01-19 00:12:11 +0000
commit4b282dd670c7263232d19412f9735d670a1b1b76 (patch)
treead6ab244be87e432940731c60ffa0bf3babf96ff /logging.c
parenta16d9bdecb572bb266a84ec90767d613ce8ce255 (diff)
Fix various issues where strncmp was only comparing a substring.
This fixes issues such as when JOINing a channel whose name is a substring of another channel, things like PARTing don't work properly.
Diffstat (limited to 'logging.c')
-rw-r--r--logging.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/logging.c b/logging.c
index bf182ec..769047a 100644
--- a/logging.c
+++ b/logging.c
@@ -134,7 +134,7 @@ int logline(char *str, struct ircdstate *ircdstate, char *basedir, int type) {
// Build the log filename
// If the message was sent to us, then log it in the sender's log file
- if (strncmp(tokens[2], ircdstate->ircnick, strlen(tokens[0])) == 0) {
+ if ((strlen(tokens[2]) == strlen(tokens[0])) && (strncmp(tokens[2], ircdstate->ircnick, strlen(tokens[0])) == 0)) {
if (!snprintf(filename, MAXCHAR, "%s/logs/%s.log", basedir, from)) {
debugprint(DEBUG_CRIT, "Error while preparing log filename for from name, returning!\n");
return 0;