mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Apply suggestions from code review
Co-authored-by: Willem Toorop <willem@nlnetlabs.nl>
This commit is contained in:
parent
a6020e4186
commit
877aa8df55
2 changed files with 14 additions and 15 deletions
|
|
@ -853,7 +853,7 @@ rrinternal_parse_rdata(sldns_buffer* strbuf, char* token, size_t token_len,
|
||||||
}
|
}
|
||||||
/* The root label is one more character, so smaller
|
/* The root label is one more character, so smaller
|
||||||
* than 1 + 1 means no Svcparam Keys */
|
* than 1 + 1 means no Svcparam Keys */
|
||||||
if (rdata_len < 2)
|
if (rdata_len < 2 || *rdata != 0)
|
||||||
return LDNS_WIREPARSE_ERR_OK;
|
return LDNS_WIREPARSE_ERR_OK;
|
||||||
|
|
||||||
rdata_len -= 1;
|
rdata_len -= 1;
|
||||||
|
|
@ -1348,26 +1348,26 @@ sldns_str2wire_svcbparam_mandatory(const char* val, uint8_t* rd, size_t* rd_len)
|
||||||
* So long as we do not distinguish between running Unbound as a primary
|
* 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
|
* or as a secondary, we default to secondary behavior and we ignore the
|
||||||
* semantic errors. */
|
* semantic errors. */
|
||||||
|
#ifdef SVCB_SEMANTIC_ERRORS
|
||||||
/* In draft-ietf-dnsop-svcb-https-06 Section 8
|
/* In draft-ietf-dnsop-svcb-https-06 Section 8
|
||||||
* automatically mandatory MUST NOT appear in its own value-list
|
* automatically mandatory MUST NOT appear in its own value-list
|
||||||
*/
|
*/
|
||||||
// if (sldns_read_uint16(rd + 4) == SVCB_KEY_MANDATORY)
|
if (sldns_read_uint16(rd + 4) == SVCB_KEY_MANDATORY)
|
||||||
// return LDNS_WIREPARSE_ERR_SVCB_MANDATORY_IN_MANDATORY;
|
return LDNS_WIREPARSE_ERR_SVCB_MANDATORY_IN_MANDATORY;
|
||||||
|
|
||||||
/* Guarantee key uniqueness. After the sort we only need to
|
/* Guarantee key uniqueness. After the sort we only need to
|
||||||
* compare neighbouring keys */
|
* compare neighbouring keys */
|
||||||
// if (count > 1) {
|
if (count > 1) {
|
||||||
// for (i = 0; i < count - 1; i++) {
|
for (i = 0; i < count - 1; i++) {
|
||||||
// uint8_t* current_pos = (rd + 4 + (sizeof(uint16_t) * i));
|
uint8_t* current_pos = (rd + 4 + (sizeof(uint16_t) * i));
|
||||||
// uint16_t key = sldns_read_uint16(current_pos);
|
uint16_t key = sldns_read_uint16(current_pos);
|
||||||
|
|
||||||
// if (key == sldns_read_uint16(current_pos + 2)) {
|
|
||||||
// return LDNS_WIREPARSE_ERR_SVCB_MANDATORY_DUPLICATE_KEY;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if (key == sldns_read_uint16(current_pos + 2)) {
|
||||||
|
return LDNS_WIREPARSE_ERR_SVCB_MANDATORY_DUPLICATE_KEY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return LDNS_WIREPARSE_ERR_OK;
|
return LDNS_WIREPARSE_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -989,7 +989,6 @@ static int sldns_wire2str_svcparam_port2str(char** s,
|
||||||
if (data_len != 2)
|
if (data_len != 2)
|
||||||
return -1; /* wireformat error, a short is 2 bytes */
|
return -1; /* wireformat error, a short is 2 bytes */
|
||||||
w = sldns_str_print(s, slen, "=%d", (int)sldns_read_uint16(data));
|
w = sldns_str_print(s, slen, "=%d", (int)sldns_read_uint16(data));
|
||||||
data += 2;
|
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue