diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-10-25 15:49:43 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-10-25 15:49:43 +0000 |
commit | 216fbb53067c8e910c8fb04d387ca5b45600039a (patch) | |
tree | 7d1dd27721916664789fb74bdd8522b1d4c0f161 | |
parent | cdf6625d2052fa1b97ea48ee22ac7ce4c9d5a3eb (diff) |
Calculate ASPATH_HEADER_SIZE correctly by using offsetof() instead of the
sizeof calculation that did not respect possible padding bytes.
OK sthen@ denis@
-rw-r--r-- | usr.sbin/bgpd/rde.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index 6e73ff6f1a1..9be8402acb5 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.198 2018/10/24 08:26:37 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.199 2018/10/25 15:49:42 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -23,6 +23,7 @@ #include <sys/queue.h> #include <sys/tree.h> #include <stdint.h> +#include <stddef.h> #include "bgpd.h" #include "log.h" @@ -125,7 +126,7 @@ struct rde_peer { #define AS_SEQUENCE 2 #define AS_CONFED_SEQUENCE 3 #define AS_CONFED_SET 4 -#define ASPATH_HEADER_SIZE (sizeof(struct aspath) - sizeof(u_char)) +#define ASPATH_HEADER_SIZE (offsetof(struct aspath, data)) struct aspath { LIST_ENTRY(aspath) entry; |