summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_hosts_compile.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-07-21 00:15:15 +0000
committerLaurent Bercot <ska@appnovation.com>2023-07-21 00:15:15 +0000
commit0ddf996441b3465e968be5d0aa61e5b6f3dbdbe2 (patch)
tree89efc9f258736dbb9e717144b357673a632a73e3 /src/libs6dns/s6dns_hosts_compile.c
parent8c904eff93d7c038855f2c1cee8ea54bdb4dae52 (diff)
downloads6-dns-0ddf996441b3465e968be5d0aa61e5b6f3dbdbe2.tar.xz
Fix noqualify for /etc/hosts compilation
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6dns/s6dns_hosts_compile.c')
-rw-r--r--src/libs6dns/s6dns_hosts_compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs6dns/s6dns_hosts_compile.c b/src/libs6dns/s6dns_hosts_compile.c
index cf3e304..b57ffd3 100644
--- a/src/libs6dns/s6dns_hosts_compile.c
+++ b/src/libs6dns/s6dns_hosts_compile.c
@@ -230,7 +230,8 @@ static int s6dns_hosts_parse (buffer *b, hostdata *hd)
else
{
uint32_t d ;
- if (!stralloc_catb(&hd->storage, ".", 2)) goto err ;
+ if ((hd->storage.s[hd->storage.len - 1] != '.' && !stralloc_catb(&hd->storage, ".", 1))
+ || !stralloc_0(&hd->storage)) goto err ;
if (!avltree_search(&hd->byfqdn, hd->storage.s + mark, &d))
{
if (!gensetdyn_new(&hd->fqdn, &d)) goto err ;