diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-10-20 00:01:35 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-10-20 08:29:30 +0200 |
commit | 7d24803fb3fc8063a76df52a86f569605d8ec7c5 (patch) | |
tree | 03886c30a0a8f963693dae50483465d684cf96f0 /conf.c | |
parent | b0b77118fee59b0db6eb3823b0191d9cd0ef9fc6 (diff) | |
download | passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar.gz passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar.bz2 passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar.lz passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar.xz passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.tar.zst passt-7d24803fb3fc8063a76df52a86f569605d8ec7c5.zip |
conf: Always pass an empty buffer to line_read() in get_dns()
Given that get_dns() touches the buffer read by line_read(), we
can't optimise that by passing the existing buffer.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -293,8 +293,7 @@ static void get_dns(struct ctx *c) if ((fd = open("/etc/resolv.conf", O_RDONLY)) < 0) goto out; - *buf = 0; - while (line_read(buf, BUFSIZ, fd)) { + while (!(*buf = 0) && line_read(buf, BUFSIZ, fd)) { if (!dns_set && strstr(buf, "nameserver ") == buf) { p = strrchr(buf, ' '); if (!p) |