From: TCY16 <8014108+TCY16@users.noreply.github.com> Date: Fri, 21 May 2021 13:42:56 +0000 (+0200) Subject: Apply suggestions from code review X-Git-Tag: release-1.13.2rc1~42^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24e39a09a8cc2353d9698c7baef0e60f467a00f2;p=thirdparty%2Funbound.git Apply suggestions from code review Co-authored-by: Willem Toorop --- diff --git a/sldns/rrdef.c b/sldns/rrdef.c index 125d3d0ab..803a0fa7d 100644 --- a/sldns/rrdef.c +++ b/sldns/rrdef.c @@ -382,7 +382,7 @@ static sldns_rr_descriptor rdata_field_descriptors[] = { {LDNS_RR_TYPE_ZONEMD, "ZONEMD", 4, 4, type_zonemd_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, /* 64 */ {LDNS_RR_TYPE_SVCB, "SVCB", 2, 2, type_svcb_wireformat, LDNS_RDF_TYPE_SVCPARAM, LDNS_RR_NO_COMPRESS, 0 }, -{(enum sldns_enum_rr_type)0, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + {LDNS_RR_TYPE_HTTPS, "HTTPS", 2, 2, type_svcb_wireformat, LDNS_RDF_TYPE_SVCPARAM, LDNS_RR_NO_COMPRESS, 0 }, {(enum sldns_enum_rr_type)0, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {(enum sldns_enum_rr_type)0, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {(enum sldns_enum_rr_type)0, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, diff --git a/sldns/rrdef.h b/sldns/rrdef.h index cd65c4126..42d5de064 100644 --- a/sldns/rrdef.h +++ b/sldns/rrdef.h @@ -355,7 +355,7 @@ enum sldns_enum_rdf_type /** TSIG extended 16bit error value */ LDNS_RDF_TYPE_TSIGERROR, - /* draft-ietf-dnsop-svcb-https-04: + /* draft-ietf-dnsop-svcb-https-05: * each SvcParam consisting of a SvcParamKey=SvcParamValue pair or * a standalone SvcParamKey */ LDNS_RDF_TYPE_SVCPARAM, diff --git a/sldns/str2wire.c b/sldns/str2wire.c index a35dfc836..f905939fd 100644 --- a/sldns/str2wire.c +++ b/sldns/str2wire.c @@ -1055,8 +1055,8 @@ sldns_str2wire_svcbparam_ipv4hint(const char* val, uint8_t* rd, size_t* rd_len) while (count) { if (!(next_ip_str = strchr(val, ','))) { if (inet_pton(AF_INET, val, rd + *rd_len) != 1) - *rd_len += LDNS_IP4ADDRLEN; break; + *rd_len += LDNS_IP4ADDRLEN; assert(count == 1); @@ -1067,10 +1067,10 @@ sldns_str2wire_svcbparam_ipv4hint(const char* val, uint8_t* rd, size_t* rd_len) memcpy(ip_str, val, next_ip_str - val); ip_str[next_ip_str - val] = 0; if (inet_pton(AF_INET, ip_str, rd + *rd_len) != 1) { - *rd_len += LDNS_IP4ADDRLEN; val = ip_str; /* to use in error reporting below */ break; } + *rd_len += LDNS_IP4ADDRLEN; val = next_ip_str + 1; } diff --git a/sldns/wire2str.c b/sldns/wire2str.c index 7d1143c6d..8ade3daca 100644 --- a/sldns/wire2str.c +++ b/sldns/wire2str.c @@ -1122,7 +1122,7 @@ int sldns_wire2str_svcparam_scan(uint8_t** d, size_t* dlen, char** s, size_t* sl uint8_t* data = *d; int written_chars = 0; - if(*dlen == 0) return 0; /* verify that we actualy have data */ + if(*dlen < 4) return 0; /* verify that we actualy have data */ svcparamkey = sldns_read_uint16(data);