]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Apply suggestions from code review
authorTCY16 <8014108+TCY16@users.noreply.github.com>
Fri, 21 May 2021 14:09:18 +0000 (16:09 +0200)
committerGitHub <noreply@github.com>
Fri, 21 May 2021 14:09:18 +0000 (16:09 +0200)
Co-authored-by: Willem Toorop <willem@nlnetlabs.nl>
sldns/str2wire.c
sldns/wire2str.c

index f905939fd0e8f96c095454f3a6da53f096078b4d..05a623a2dfe6a2d974fd8d9595fdd457abd2eccd 100644 (file)
@@ -1077,8 +1077,8 @@ sldns_str2wire_svcbparam_ipv4hint(const char* val, uint8_t* rd, size_t* rd_len)
                ip_wire_dst++;
                count--;
        }
-       // if (count) /* verify that we parsed all values */
-               // ERROR "Could not parse ipv4hint SvcParamValue: "
+       if (count) /* verify that we parsed all values */
+               return LDNS_WIREPARSE_ERR_SYNTAX_IP4;
 
        return LDNS_WIREPARSE_ERR_OK;
 }
index 8ade3daca2c8c74be1d0cc75f9ce8b055f1a3975..0d41a2bb884846fb897a95f42d9ffd15686086bc 100644 (file)
@@ -984,14 +984,14 @@ sldns_wire2str_svcparam_ipv4hint2str(char** s,
                        return 0; /* wireformat error, incorrect size or inet family */
 
                w += sldns_str_print(s, slen, "=%s", ip_str);
-               data += LDNS_IP4ADDRLEN / sizeof(uint16_t);
+               data += LDNS_IP4ADDRLEN;
 
                while ((data_len -= LDNS_IP4ADDRLEN) > 0) {
                        if (inet_ntop(AF_INET, data, ip_str, sizeof(ip_str)) == NULL)
                                return 0; /* wireformat error, incorrect size or inet family */
 
                        w += sldns_str_print(s, slen, ",%s", ip_str);
-                       data += LDNS_IP4ADDRLEN / sizeof(uint16_t);
+                       data += LDNS_IP4ADDRLEN;
                }
        }