]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Fix do_access: add missing NULL check on msg parameter
authorBaptiste Daroussin <bapt@FreeBSD.org>
Mon, 8 Jun 2026 21:18:44 +0000 (23:18 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Fri, 12 Jun 2026 09:56:44 +0000 (11:56 +0200)
The final fallthrough path (no rules matched) called xasprintf(msg, ...)
without checking if msg != NULL, unlike all other xasprintf calls in the
same function. If a caller passes NULL for msg, this would crash in
vasprintf(NULL, ...).

src/access.c

index a084a63298b8c15b1c2813233ff193d49e6e1d2f..1e9cd3b81d30bbb3543a4beae8608f9040ba7bdf 100644 (file)
@@ -167,9 +167,10 @@ do_access(strlist *rules, strlist *headers, const char *from, char **msg, char *
                }
        }
 
-       xasprintf(msg, "access -"
-                       " A mail from \"%s\" didn't match any rules, and"
-                       " was denied by default.", from);
+       if (msg != NULL)
+               xasprintf(msg, "access -"
+                               " A mail from \"%s\" didn't match any rules, and"
+                               " was denied by default.", from);
        return ACT_DENY;
 }