summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-01-09 23:18:12 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-01-09 23:18:12 +0000
commit0f1aa781de5bde8c6b345cb166cc2f87bfece14d (patch)
treec87a77d728cc7ffc1ac4d2358522ce3ce0f4b879 /sys
parent096cf5f85bf6c1e24c3a6481dc50e5060b512f94 (diff)
Proper netmask handling.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pfkeyv2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 2c602be0d99..bff9d982740 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1144,7 +1144,9 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
sproto = 0;
/* Generic netmask handling, works for IPv4 and IPv6 */
- for (lp = 0; lp < src->sa.sa_len; lp++)
+ for (lp = 0;
+ lp < src->sa.sa_len - (sizeof(u_int8_t) + sizeof(sa_family_t);
+ lp++)
{
src->sa.sa_data[lp] &= srcmask->sa.sa_data[lp];
dst->sa.sa_data[lp] &= dstmask->sa.sa_data[lp];