]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: set_line() - Add check against empty lines and keys, drop suffixing...
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 3 Feb 2023 16:25:19 +0000 (16:25 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Fri, 3 Feb 2023 16:53:46 +0000 (16:53 +0000)
The previous check is no longer necessary as keys are now always followed
by '=', but in case of empty lines now the function would crash instead
of setting "plugin/=yes" (which didn't make sense either)

src/lib-storage/mail-storage-service.c

index cccb420f54297126a0f99206dc352e6149b95d7e..6fb3d05a3565976e730ce8feff4c0d02939c20d4 100644 (file)
@@ -142,10 +142,13 @@ static int set_line(struct mail_storage_service_ctx *ctx,
        size_t len;
        int ret;
 
-       if (strchr(line, '=') == NULL)
-               line = t_strconcat(line, "=yes", NULL);
        orig_key = key = t_strcut(line, '=');
 
+       /* Ignore empty keys (and lines) rather than prepend 'plugin/=' to them.
+          Also, prevent emtpy lines from crashing later in settings_parse_line() */
+       if (*key == '\0')
+               return 1;
+
        len = strlen(key);
        if (len > 0 && key[len-1] == '+') {
                /* key+=value */