]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Ensure there is enough space for the mask
authorFederico G. Schwindt <fgsch@lodoss.net>
Sat, 20 Apr 2013 09:53:16 +0000 (10:53 +0100)
committerFederico G. Schwindt <fgsch@lodoss.net>
Sat, 20 Apr 2013 09:53:16 +0000 (10:53 +0100)
As pointed by Alex while strl{cat,cpy} take the full length
we need to leave space to ensure a proper mask is always created
so revert the removal of - N from my last change.

src/ngircd/lists.c

index d98dc6c847ec85cf9d13fca676bb78f26e5dd4df..b0accd41edb6476a6d85e27567618b65402906dd 100644 (file)
@@ -279,16 +279,16 @@ Lists_MakeMask(const char *Pattern, char *mask, size_t len)
 
        if (!at && !excl) {
                /* Neither "!" nor "@" found: use string as nickname */
-               strlcpy(mask, Pattern, len);
+               strlcpy(mask, Pattern, len - 5);
                strlcat(mask, "!*@*", len);
        } else if (!at && excl) {
                /* Domain part is missing */
-               strlcpy(mask, Pattern, len);
+               strlcpy(mask, Pattern, len - 3);
                strlcat(mask, "@*", len);
        } else if (at && !excl) {
                /* User name is missing */
                *at = '\0'; at++;
-               strlcpy(mask, Pattern, len);
+               strlcpy(mask, Pattern, len - 5);
                strlcat(mask, "!*@", len);
                strlcat(mask, at, len);
        } else {