diff options
author | 2014-02-26 20:00:08 +0000 | |
---|---|---|
committer | 2014-02-26 20:00:08 +0000 | |
commit | 01b887f7d47f183107159279377a4c1e061d8590 (patch) | |
tree | 0e0e99d72bc0cf0e1b1068eff5ef46bf54da3cd5 /lib/libc/asr/getaddrinfo_async.c | |
parent | Update section about autoinstall and sync with reality. (diff) | |
download | wireguard-openbsd-01b887f7d47f183107159279377a4c1e061d8590.tar.xz wireguard-openbsd-01b887f7d47f183107159279377a4c1e061d8590.zip |
Do not restrict chars in dname during label expansion, but validate resulting
hostnames before returning them to the caller.
ok deraadt@
Diffstat (limited to 'lib/libc/asr/getaddrinfo_async.c')
-rw-r--r-- | lib/libc/asr/getaddrinfo_async.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c index 53b8bd1cda0..b573dac081a 100644 --- a/lib/libc/asr/getaddrinfo_async.c +++ b/lib/libc/asr/getaddrinfo_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getaddrinfo_async.c,v 1.20 2014/02/17 11:04:23 eric Exp $ */ +/* $OpenBSD: getaddrinfo_async.c,v 1.21 2014/02/26 20:00:08 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -27,6 +27,7 @@ #include <err.h> #include <errno.h> +#include <resolv.h> /* for res_hnok */ #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -767,14 +768,6 @@ addrinfo_from_pkt(struct async *as, char *pkt, size_t pktlen) rr.rr_class != q.q_class) continue; - if (as->as.ai.fqdn == NULL) { - asr_strdname(q.q_dname, buf, sizeof buf); - buf[strlen(buf) - 1] = '\0'; - as->as.ai.fqdn = strdup(buf); - if (as->as.ai.fqdn == NULL) - return (-1); /* errno set */ - } - memset(&u, 0, sizeof u); if (rr.rr_type == T_A) { u.sain.sin_len = sizeof u.sain; @@ -792,7 +785,7 @@ addrinfo_from_pkt(struct async *as, char *pkt, size_t pktlen) if (as->as.ai.hints.ai_flags & AI_CANONNAME) { asr_strdname(rr.rr_dname, buf, sizeof buf); buf[strlen(buf) - 1] = '\0'; - c = buf; + c = res_hnok(buf) ? buf : NULL; } else if (as->as.ai.hints.ai_flags & AI_FQDN) c = as->as.ai.fqdn; else |