summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-06-07 17:42:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-06-07 17:42:59 +0000
commitff809ea61a82bbebff839e33353ecc54ad87e97f (patch)
tree4bd7bedc30168fa1deaf146c0edc7e3c2e8f8098
parent5496afd89186ea33b3dd12f19b537e0bd67d5044 (diff)
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.c8
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;