From 2fbf20c9e41b3e889e9a22faa97038efbdaa9f45 Mon Sep 17 00:00:00 2001 From: fumiama Date: Sat, 1 Jan 2022 17:49:37 +0800 Subject: [PATCH] fix out of bound --- .gitignore | 1 + gold/link/me.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4482273..4879299 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ .DS_Store config.yaml +WireGold diff --git a/gold/link/me.go b/gold/link/me.go index 8aef9f2..b64acb6 100644 --- a/gold/link/me.go +++ b/gold/link/me.go @@ -155,7 +155,7 @@ func (p PacketID) issame(packet []byte) bool { func (m *Me) sendAllSameDst(packet []byte) (n int, rem []byte) { rem = packet if !waterutil.IsIPv4(packet) { - for waterutil.IsIPv6(rem) { + for len(rem) > 20 && waterutil.IsIPv6(rem) { pktl := int(binary.BigEndian.Uint16(packet[4:6])) + 40 if pktl > len(rem) { return