diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-02-23 16:46:25 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-02-23 16:46:25 +0000 |
commit | ac014ddac69778ceed12e4b2c82774ead13b4036 (patch) | |
tree | 57c1ab24e0c91f5dceb3540f7b3eb7d86e645402 /usr.sbin | |
parent | 491e511bb275eeda7b68cd8a24b96f6faa0308a4 (diff) |
While searching a different bug found those two gems. The ntohs is obvious
the plen adjusting is needed to jump over the value that we ignore.
yaya henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/rde_attr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index 98279164539..f07f32d01e6 100644 --- a/usr.sbin/bgpd/rde_attr.c +++ b/usr.sbin/bgpd/rde_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.12 2004/02/19 23:07:00 claudio Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.13 2004/02/23 16:46:24 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -78,6 +78,7 @@ attr_parse(u_char *p, u_int16_t len, struct attr_flags *a, int ebgp) if (len - plen < 2) return (-1); UPD_READ(&attr_len, p, plen, 2); + attr_len = ntohs(attr_len); } else { UPD_READ(&tmp8, p, plen, 1); attr_len = tmp8; @@ -135,7 +136,8 @@ attr_parse(u_char *p, u_int16_t len, struct attr_flags *a, int ebgp) return (-1); if (ebgp) { /* ignore local-pref attr for non ibgp peers */ - a->lpref = 0; /* set a default value */ + a->lpref = 0; /* set a default value ... */ + plen += 4; /* and ignore the real value */ break; } WFLAG(a->wflags, F_ATTR_LOCALPREF); |