- For #1189, homogenize the input buffer size for dname_str().

This commit is contained in:
Yorgos Thessalonikefs
2024-12-02 11:53:56 +01:00
parent 1cd2fb3b9d
commit f46acec35f
26 changed files with 110 additions and 105 deletions
+5 -3
View File
@@ -353,7 +353,7 @@ autr_tp_create(struct val_anchors* anchors, uint8_t* own, size_t own_len,
lock_basic_lock(&anchors->lock);
if(!rbtree_insert(anchors->tree, &tp->node)) {
char buf[LDNS_MAX_DOMAINLEN+1];
char buf[LDNS_MAX_DOMAINLEN];
lock_basic_unlock(&anchors->lock);
dname_str(tp->name, buf);
log_err("trust anchor for '%s' presented twice", buf);
@@ -363,7 +363,7 @@ autr_tp_create(struct val_anchors* anchors, uint8_t* own, size_t own_len,
return NULL;
}
if(!rbtree_insert(&anchors->autr->probe, &tp->autr->pnode)) {
char buf[LDNS_MAX_DOMAINLEN+1];
char buf[LDNS_MAX_DOMAINLEN];
(void)rbtree_delete(anchors->tree, tp);
lock_basic_unlock(&anchors->lock);
dname_str(tp->name, buf);
@@ -2288,7 +2288,9 @@ static void
autr_debug_print_tp(struct trust_anchor* tp)
{
struct autr_ta* ta;
char buf[257];
/* Note: buf is also used for autr_ctime_r but that only needs a size
* of 26, so LDNS_MAX_DOMAINLEN is enough. */
char buf[LDNS_MAX_DOMAINLEN];
if(!tp->autr)
return;
dname_str(tp->name, buf);
+1 -1
View File
@@ -1018,7 +1018,7 @@ anchors_assemble_rrsets(struct val_anchors* anchors)
ta->name, LDNS_RR_TYPE_DNSKEY, ta->dclass);
}
if(nods == ta->numDS && nokey == ta->numDNSKEY) {
char b[257];
char b[LDNS_MAX_DOMAINLEN];
dname_str(ta->name, b);
log_warn("trust anchor %s has no supported algorithms,"
" the anchor is ignored (check if you need to"
+1 -1
View File
@@ -210,7 +210,7 @@ val_init(struct module_env* env, int id)
struct trust_anchor* anchor = anchors_find_any_noninsecure(
env->anchors);
if(anchor) {
char b[LDNS_MAX_DOMAINLEN+2];
char b[LDNS_MAX_DOMAINLEN];
dname_str(anchor->name, b);
log_warn("validator: disable-edns-do is enabled, but there is a trust anchor for '%s'. Since DNSSEC could not work, the disable-edns-do setting is turned off. Continuing without it.", b);
lock_basic_unlock(&anchor->lock);