From 8aec671860b479c4ac0defd9a1f553119361ae35 Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Tue, 1 Aug 2023 15:15:33 +0200 Subject: [PATCH] - More braces and formatting for Fix for EDNS EDE size calculation to avoid future bugs. --- doc/Changelog | 2 ++ util/data/msgencode.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index b3ac846ce..448eda5f5 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,8 @@ when there isn't enough space. - For #911: Try to trim EXTRA-TEXT (and LDNS_EDE_OTHER options altogether) before giving up on attaching EDE options. + - More braces and formatting for Fix for EDNS EDE size calculation to + avoid future bugs. 1 August 2023: Wouter - Fix for EDNS EDE size calculation. diff --git a/util/data/msgencode.c b/util/data/msgencode.c index f42dd6b2d..81d3fe7ef 100644 --- a/util/data/msgencode.c +++ b/util/data/msgencode.c @@ -835,21 +835,21 @@ calc_ede_option_size(struct edns_data* edns, uint16_t* txt_size) for(opt = edns->opt_list_inplace_cb_out; opt; opt = opt->next) { if(opt->opt_code == LDNS_EDNS_EDE) { rdatalen += 4 + opt->opt_len; - if(opt->opt_len > 2) - *txt_size += opt->opt_len - 2; + if(opt->opt_len > 2) *txt_size += opt->opt_len - 2; if(opt->opt_len >= 2 && sldns_read_uint16( - opt->opt_data) == LDNS_EDE_OTHER) + opt->opt_data) == LDNS_EDE_OTHER) { *txt_size += 4 + 2; + } } } for(opt = edns->opt_list_out; opt; opt = opt->next) { if(opt->opt_code == LDNS_EDNS_EDE) { rdatalen += 4 + opt->opt_len; - if(opt->opt_len > 2) - *txt_size += opt->opt_len - 2; + if(opt->opt_len > 2) *txt_size += opt->opt_len - 2; if(opt->opt_len >= 2 && sldns_read_uint16( - opt->opt_data) == LDNS_EDE_OTHER) + opt->opt_data) == LDNS_EDE_OTHER) { *txt_size += 4 + 2; + } } } return rdatalen;