diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-20 15:09:08 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-20 15:09:08 +0000 |
commit | dda3b61b807d9ff303418e7520e37782e8796b5c (patch) | |
tree | 03575b25876fe2bbf7ee729041941fed4bf7d570 /usr.sbin/bgpd | |
parent | 602109016ba00dbee7ece17be86c736a083e1926 (diff) |
formulate two comparisons sligthly different to prevent the left side from
becoming negative. this was logically impossible already but this way gcc
has the chance to notice that as well.
together with the last commit this makes bgod -Wsign-compare clean
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index e9b6388563a..9e10396c2d2 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.10 2003/12/20 14:36:46 henning Exp $ */ +/* $OpenBSD: rde.c,v 1.11 2003/12/20 15:09:07 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -296,7 +296,7 @@ rde_update_dispatch(struct imsg *imsg) memcpy(&len, p, 2); withdrawn_len = ntohs(len); p += 2; - if (imsg->hdr.len - IMSG_HEADER_SIZE < 2 + withdrawn_len + 2) { + if (imsg->hdr.len < IMSG_HEADER_SIZE + 2 + withdrawn_len + 2) { rde_update_err(peer->conf.id, ERR_UPD_ATTRLIST); return (-1); } @@ -315,8 +315,8 @@ rde_update_dispatch(struct imsg *imsg) memcpy(&len, p, 2); attrpath_len = ntohs(len); p += 2; - if (imsg->hdr.len - IMSG_HEADER_SIZE < - 2 + withdrawn_len + 2 + attrpath_len) { + if (imsg->hdr.len < + IMSG_HEADER_SIZE + 2 + withdrawn_len + 2 + attrpath_len) { rde_update_err(peer->conf.id, ERR_UPD_ATTRLIST); return (-1); } |