From 7199ebc203f74fd9e44595474de6bdc41740c5cf Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Tue, 25 May 2021 15:17:36 +0300 Subject: [PATCH] Resolver: fixed off-by-one write in ngx_resolver_copy(). Reported by Luis Merino, Markus Vervier, Eric Sesterhenn, X41 D-Sec GmbH. --- src/core/ngx_resolver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c index 793907010..63b26193d 100644 --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -4008,15 +4008,15 @@ done: n = *src++; } else { + if (dst != name->data) { + *dst++ = '.'; + } + ngx_strlow(dst, src, n); dst += n; src += n; n = *src++; - - if (n != 0) { - *dst++ = '.'; - } } if (n == 0) {