]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Apply suggestions from code review
authortcarpay <8014108+TCY16@users.noreply.github.com>
Thu, 1 Jul 2021 10:45:14 +0000 (12:45 +0200)
committerGitHub <noreply@github.com>
Thu, 1 Jul 2021 10:45:14 +0000 (12:45 +0200)
Co-authored-by: Wouter Wijngaards <wcawijngaards@users.noreply.github.com>
sldns/str2wire.c
testcode/readzone.c

index db572e4e15754b238be4d134c30cfd865bbea497..642134ecc4fb96e1a5926df58ab04c32e1e33e94 100644 (file)
@@ -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;
index 3854465eb84d115ed4daf534a945965dd5b90d54..eeab6155d01e5e165b94af3f66ff42ccf2ec8eca 100644 (file)
@@ -1,3 +1,4 @@
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -5,7 +6,6 @@
 #include <unistd.h>
 
 #include <stdint.h>
-#include "config.h"
 #include "sldns/str2wire.h"
 #include "sldns/wire2str.h"