From 07355f503a9b0a3ab7a051e2931499a4c5898b15 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Fri, 6 Jun 2014 19:20:07 +0200 Subject: accept trailing . and empty domain names trailing . should be accepted in domain name strings by convention (RFC 1034), host name lookup accepts "." but rejects empty "", res_* interfaces also accept empty name following existing practice. --- src/network/res_querydomain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/network/res_querydomain.c') diff --git a/src/network/res_querydomain.c b/src/network/res_querydomain.c index 8ba31f45..727e6f6b 100644 --- a/src/network/res_querydomain.c +++ b/src/network/res_querydomain.c @@ -3,10 +3,10 @@ int res_querydomain(const char *name, const char *domain, int class, int type, unsigned char *dest, int len) { - char tmp[254]; - size_t nl = strnlen(name, 254); - size_t dl = strnlen(domain, 254); - if (nl+dl+1 > 253) return -1; + char tmp[255]; + size_t nl = strnlen(name, 255); + size_t dl = strnlen(domain, 255); + if (nl+dl+1 > 254) return -1; memcpy(tmp, name, nl); tmp[nl] = '.'; memcpy(tmp+nl+1, domain, dl+1); -- cgit v1.2.1