summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2004-10-08 05:59:56 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2004-10-08 05:59:56 +0000
commit47dfbf45f218ed0a4af52c24dc1aad081d62bea1 (patch)
treecb185edcc99f097f6a82016263f82bddf91678de /sbin
parent139a5d68bb265945319676ee6e99495395ef1f5a (diff)
Don't increment beyond end of message.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipsecadm/pfkdump.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/ipsecadm/pfkdump.c b/sbin/ipsecadm/pfkdump.c
index 9dcd6f81fbd..7222fa39491 100644
--- a/sbin/ipsecadm/pfkdump.c
+++ b/sbin/ipsecadm/pfkdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkdump.c,v 1.13 2004/08/10 16:03:00 ho Exp $ */
+/* $OpenBSD: pfkdump.c,v 1.14 2004/10/08 05:59:55 ho Exp $ */
/*
* Copyright (c) 2003 Markus Friedl. All rights reserved.
@@ -283,9 +283,9 @@ print_msg(struct sadb_msg *msg, int promisc)
printf("\terrno %u: %s\n", msg->sadb_msg_errno,
strerror(msg->sadb_msg_errno));
for (ext = (struct sadb_ext *)(msg + 1);
- ext->sadb_ext_len > 0 &&
(u_int8_t *)ext - (u_int8_t *)msg <
- msg->sadb_msg_len * PFKEY2_CHUNK;
+ msg->sadb_msg_len * PFKEY2_CHUNK &&
+ ext->sadb_ext_len > 0;
ext = (struct sadb_ext *)((u_int8_t *)ext +
ext->sadb_ext_len * PFKEY2_CHUNK))
print_ext(ext, msg);