diff options
author | 2005-06-07 17:42:58 +0000 | |
---|---|---|
committer | 2005-06-07 17:42:58 +0000 | |
commit | d0ab094f89e74728f02b2f79613f6d5bce6aaf22 (patch) | |
tree | 1f00e2557e0029877f5a91a5ed8e75a5c57e5306 | |
parent | add support for the BCM5714. (diff) | |
download | wireguard-openbsd-d0ab094f89e74728f02b2f79613f6d5bce6aaf22.tar.xz wireguard-openbsd-d0ab094f89e74728f02b2f79613f6d5bce6aaf22.zip |
avoid retarded C unsigned char -> signed integer promotion rules.
mac->ac_enaddr[2] << 24 resulted in sign extension smashing other stuff
djast@cs.toronto.edu, ok mickey
-rw-r--r-- | sys/net/bridgestp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 0accee5b6f0..dc20b1e21b2 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgestp.c,v 1.16 2003/11/16 20:30:07 avsm Exp $ */ +/* $OpenBSD: bridgestp.c,v 1.17 2005/06/07 17:42:58 deraadt Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -896,8 +896,10 @@ bstp_initialization(sc) (((u_int64_t)sc->sc_bridge_priority) << 48) | (((u_int64_t)mac->ac_enaddr[0]) << 40) | (((u_int64_t)mac->ac_enaddr[1]) << 32) | - (mac->ac_enaddr[2] << 24) | (mac->ac_enaddr[3] << 16) | - (mac->ac_enaddr[4] << 8) | (mac->ac_enaddr[5]); + ((unsigned int)mac->ac_enaddr[2] << 24) | + (((unsigned int)mac->ac_enaddr[3] << 16) | + (((unsigned int)mac->ac_enaddr[4] << 8) | + (((unsigned int)mac->ac_enaddr[5]); sc->sc_designated_root = sc->sc_bridge_id; sc->sc_root_path_cost = 0; |