summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2015-01-09 08:09:39 +0000
committerhenning <henning@openbsd.org>2015-01-09 08:09:39 +0000
commit97d44d7c1ddd48c45048aad3419e6b568bfa8c74 (patch)
tree16f9119a1b54225fab65806301980699c114b53d
parentremove excessive/wrong use of sys/param.h (diff)
downloadwireguard-openbsd-97d44d7c1ddd48c45048aad3419e6b568bfa8c74.tar.xz
wireguard-openbsd-97d44d7c1ddd48c45048aad3419e6b568bfa8c74.zip
move the ignore-microsec-timestamp bit from mrt_parse to mrt_parse_dump_mp
fixes a coredump reachable via show mrt file From: Benjamin Baier <programmer at netzbasis dot de>, ok claudio
-rw-r--r--usr.sbin/bgpctl/mrtparser.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/bgpctl/mrtparser.c b/usr.sbin/bgpctl/mrtparser.c
index 9c8cb6b9891..d8f7cb8e89b 100644
--- a/usr.sbin/bgpctl/mrtparser.c
+++ b/usr.sbin/bgpctl/mrtparser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mrtparser.c,v 1.5 2014/10/08 16:15:37 deraadt Exp $ */
+/* $OpenBSD: mrtparser.c,v 1.6 2015/01/09 08:09:39 henning Exp $ */
/*
* Copyright (c) 2011 Claudio Jeker <claudio@openbsd.org>
*
@@ -170,10 +170,6 @@ mrt_parse(int fd, struct mrt_parser *p, int verbose)
}
break;
case MSG_PROTOCOL_BGP4MP_ET:
- /* currently just ignore the microsec field */
- msg = (char *)msg + sizeof(u_int32_t);
- h.length -= sizeof(u_int32_t);
- /* FALLTHROUGH */
case MSG_PROTOCOL_BGP4MP:
switch (ntohs(h.subtype)) {
case BGP4MP_STATE_CHANGE:
@@ -546,6 +542,12 @@ mrt_parse_dump_mp(struct mrt_hdr *hdr, void *msg, struct mrt_peer **pp,
u_int8_t safi, nhlen;
sa_family_t af;
+ /* just ignore the microsec field for _ET header for now */
+ if (ntohs(hdr->type) == MSG_PROTOCOL_BGP4MP_ET) {
+ b = (char *)b + sizeof(u_int32_t);
+ len -= sizeof(u_int32_t);
+ }
+
if (*pp == NULL) {
*pp = calloc(1, sizeof(struct mrt_peer));
if (*pp == NULL)