From: tcarpay <8014108+TCY16@users.noreply.github.com> Date: Thu, 1 Jul 2021 10:45:14 +0000 (+0200) Subject: Apply suggestions from code review X-Git-Tag: release-1.13.2rc1~42^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e41125495df6033811989d471621d0d16ba20aa3;p=thirdparty%2Funbound.git Apply suggestions from code review Co-authored-by: Wouter Wijngaards --- diff --git a/sldns/str2wire.c b/sldns/str2wire.c index db572e4e1..642134ecc 100644 --- a/sldns/str2wire.c +++ b/sldns/str2wire.c @@ -650,7 +650,7 @@ static int sldns_str2wire_check_svcbparams(uint8_t* rdata, uint16_t rdata_len) rdata_ptr += svcbparam_len; nparams += 1; - if (nparams > MAX_NUMBER_OF_SVCPARAMS) + if (nparams >= MAX_NUMBER_OF_SVCPARAMS) return LDNS_WIREPARSE_ERR_SVCB_TOO_MANY_PARAMS; } @@ -1355,7 +1355,7 @@ sldns_str2wire_svcbparam_mandatory(const char* val, uint8_t* rd, size_t* rd_len) /* The code below revolves around sematic errors in the SVCParam set. * So long as we do not distinguish between running Unbound as a primary * or as a secondary, we default to secondary behavior and we ignore the - * sematic errors. */ + * semantic errors. */ /* In draft-ietf-dnsop-svcb-https-06 Section 8 * automatically mandatory MUST NOT appear in its own value-list @@ -1467,7 +1467,7 @@ sldns_str2wire_svcbparam_alpn_value(const char* val, val_len = strlen(val); if (val_len > sizeof(unescaped_dst)) { - return LDNS_WIREPARSE_ERR_SYNTAX_INTEGER_OVERFLOW; + return LDNS_WIREPARSE_ERR_SVCB_ALPN_KEY_TOO_LARGE; } while (val_len) { size_t dst_len; diff --git a/testcode/readzone.c b/testcode/readzone.c index 3854465eb..eeab6155d 100644 --- a/testcode/readzone.c +++ b/testcode/readzone.c @@ -1,3 +1,4 @@ +#include "config.h" #include #include #include @@ -5,7 +6,6 @@ #include #include -#include "config.h" #include "sldns/str2wire.h" #include "sldns/wire2str.h"