Fix off by one error in dname overflow check in str2rdf_dname
@@ -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) {
