Skip to content

Commit

Permalink
config: Consistently truncate value at the first NUL in value input file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed Aug 30, 2018
1 parent 92836cf commit 505a449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/config/config-parser.c
Expand Up @@ -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);
Expand Down

0 comments on commit 505a449

Please sign in to comment.