devip: fix router adv/sol options validation (options padded to 8 bytes)

This commit is contained in:
cinap_lenrek 2018-08-27 20:58:48 +02:00
parent cff1ab5fdf
commit 5c945a0b48

View file

@ -617,7 +617,7 @@ valid(Proto *icmp, Ipifc *ifc, Block *bp, Icmppriv6 *ipriv)
goto err;
}
sz = IPICMPSZ + 8;
while (sz+1 < pktsz) {
while (sz+8 <= pktsz) {
osz = packet[sz+1];
if(osz <= 0) {
ipriv->stats[OptlenErrs6]++;
@ -634,7 +634,7 @@ valid(Proto *icmp, Ipifc *ifc, Block *bp, Icmppriv6 *ipriv)
}
unsp = (ipcmp(p->src, v6Unspecified) == 0);
sz = IPICMPSZ + 8;
while (sz+1 < pktsz) {
while (sz+8 <= pktsz) {
osz = packet[sz+1];
if(osz <= 0 ||
(unsp && packet[sz] == SRC_LLADDR)) {