summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-10-16 16:31:50 +0900
committerHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-10-16 16:31:50 +0900
commit2f84fb8c3624d2f86ebe97a76b4e2e202fc388ce (patch)
tree8ac99400c7e6f8946451667d2af8c8042c06d356
parent748ad73b6fffcdd9c8b464533e77990bb1d311b4 (diff)
packet: avoid overflow
Signed-off-by: Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>
-rw-r--r--packet/bgp.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 83d6a713..7b9961ed 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -1458,7 +1458,7 @@ func (esi *EthernetSegmentIdentifier) String() string {
s.WriteString(fmt.Sprintf("priority %d", binary.BigEndian.Uint16(esi.Value[6:8])))
case ESI_MAC:
s.WriteString(fmt.Sprintf("system mac %s, ", net.HardwareAddr(esi.Value[:6]).String()))
- s.WriteString(fmt.Sprintf("local discriminator %d", esi.Value[6]<<16|esi.Value[7]<<8|esi.Value[8]))
+ s.WriteString(fmt.Sprintf("local discriminator %d", uint32(esi.Value[6])<<16|uint32(esi.Value[7])<<8|uint32(esi.Value[8])))
case ESI_ROUTERID:
s.WriteString(fmt.Sprintf("router id %s, ", net.IP(esi.Value[:4])))
s.WriteString(fmt.Sprintf("local discriminator %d", binary.BigEndian.Uint32(esi.Value[4:8])))