ndisc: fix an off by 2 write in ndisc_option_build_encrypted_dns()
This function constructs the NDisc Encrypted DNS option (RFC 9463). `poff` is initialized to `off + sizeof(uint16_t)` - pointing past the 2 bytes SvcParam length field. After all SvcParams are written the length is set at line 1541. `LESS_BY(poff, off) = poff - off` includes the 2 bytes length field itself. The correct value is `poff - off - sizeof(uint16_t)`.
This commit is contained in:
committed by
Luca Boccassi
parent
186a8486fc
commit
d3157f2a67
@@ -1538,7 +1538,7 @@ static int ndisc_option_build_encrypted_dns(const sd_ndisc_option *option, usec_
|
|||||||
poff += plen;
|
poff += plen;
|
||||||
}
|
}
|
||||||
|
|
||||||
unaligned_write_be16(buf + off, LESS_BY(poff, off));
|
unaligned_write_be16(buf + off, LESS_BY(poff, off + sizeof(uint16_t)));
|
||||||
off = poff;
|
off = poff;
|
||||||
|
|
||||||
padding:
|
padding:
|
||||||
|
|||||||
Reference in New Issue
Block a user