2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Merge branch '2868-svbc-fromwire-should-reject-zero-length-alpn-elements' into 'main'

Resolve "SVBC fromwire should reject zero length ALPN elements"

Closes #2868

See merge request isc-projects/bind9!5336
This commit is contained in:
Mark Andrews
2021-08-19 08:36:57 +00:00
2 changed files with 6 additions and 1 deletions

View File

@@ -121,7 +121,7 @@ svcb_validate(uint16_t key, isc_region_t *region) {
}
while (region->length != 0) {
size_t l = *region->base + 1;
if (l > region->length) {
if (l == 1U || l > region->length) {
return (DNS_R_FORMERR);
}
isc_region_consume(region, l);

View File

@@ -2723,6 +2723,11 @@ https_svcb(void **state) {
* no-default-alpn (0x00 0x02) without alpn, alpn is required.
*/
WIRE_INVALID(0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00),
/*
* Alpn(0x00 0x01) with zero length elements is invalid
*/
WIRE_INVALID(0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05,
0x00, 0x00, 0x00, 0x00, 0x00),
WIRE_SENTINEL()
};
/* Test vectors from RFCXXXX */