From c156233818afad75296d9aa2ee4745c329cf92b9 Mon Sep 17 00:00:00 2001 From: Ralph Dolmans Date: Wed, 11 Dec 2019 15:39:07 +0100 Subject: [PATCH] - Fix off by one error in dname overflow check in str2rdf_dname --- str2host.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/str2host.c b/str2host.c index 0bf62d10..40af3051 100644 --- a/str2host.c +++ b/str2host.c @@ -344,7 +344,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) pq = buf; label_len = 0; for (s = str; *s; s++, q++) { - if (q > buf + LDNS_MAX_DOMAINLEN) { + if (q >= buf + LDNS_MAX_DOMAINLEN) { return LDNS_STATUS_DOMAINNAME_OVERFLOW; } *q = 0; @@ -378,7 +378,7 @@ ldns_str2rdf_dname(ldns_rdf **d, const char *str) /* add root label if last char was not '.' */ if (!ldns_dname_str_absolute(str)) { - if (q > buf + LDNS_MAX_DOMAINLEN) { + if (q >= buf + LDNS_MAX_DOMAINLEN) { return LDNS_STATUS_DOMAINNAME_OVERFLOW; } if (label_len > LDNS_MAX_LABELLEN) { -- 2.47.3