]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-passwd-file - Fix using paths with %% escaped characters but no %variables
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 Oct 2021 00:55:59 +0000 (03:55 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 7 Oct 2021 07:23:08 +0000 (07:23 +0000)
full_key might not have been NULL, causing var_expand() to read past the
array and possibly crash.

src/auth/db-passwd-file.c

index 6a5113cd44ff2c10a69d93120d9bbbb7ba5b63cd..e26c1466d66b1ef4bdb770bca05dd8cbe8d7f29d 100644 (file)
@@ -350,11 +350,12 @@ db_passwd_file_init(const char *path, bool userdb, bool debug)
 
        if (percents && !db->vars) {
                /* just extra escaped % chars. remove them. */
-               struct var_expand_table empty_table[1];
+               struct var_expand_table empty_table[1] = {
+                       { .key = '\0' },
+               };
                string_t *dest;
                const char *error;
 
-               empty_table[0].key = '\0';
                dest = t_str_new(256);
                if (var_expand(dest, path, empty_table, &error) <= 0)
                        i_unreached();