Merge revision 1.35 from NetBSD:

fix pointer/offset mistakes in handling of IPv4 options

Reported by:	Maxime Villard <maxv at NetBSD.org>
MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2018-01-24 19:06:44 +00:00
parent 1f23f8b0fe
commit b12a7532e3

View File

@ -293,7 +293,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
else
ip->ip_off = htons(0);
ptr = mtod(m, unsigned char *) + sizeof(struct ip);
ptr = mtod(m, unsigned char *);
/* IPv4 option processing */
for (off = sizeof(struct ip); off < skip;) {
@ -374,7 +374,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
/* Zeroize all other options. */
count = ptr[off + 1];
bcopy(ipseczeroes, ptr, count);
bcopy(ipseczeroes, ptr + off, count);
off += count;
break;
}