]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Consistently truncate value at the first NUL in value input file
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 21 Apr 2018 12:53:42 +0000 (15:53 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Aug 2018 08:12:34 +0000 (11:12 +0300)
When value contained "<file", the file was added as a value. The setting
values don't currently support NULs, so the value gets truncated at the
first NUL. However, the previous code could have appended more data to
the value. This could have produced somewhat confusing results.

src/config/config-parser.c

index 4571db4967466f0cdaf31ea7829d7cebaddd680b..a4898fb44931b903b18c8413d64d0c5f2baa5bb3 100644 (file)
@@ -479,7 +479,7 @@ str_append_file(string_t *str, const char *key, const char *path,
                return -1;
        }
        while ((ret = read(fd, buf, sizeof(buf))) > 0)
-               str_append_n(str, buf, ret);
+               str_append_data(str, buf, ret);
        if (ret < 0) {
                *error_r = t_strdup_printf("%s: read(%s) failed: %m",
                                           key, path);