aboutsummaryrefslogtreecommitdiff
path: root/bencode
diff options
context:
space:
mode:
Diffstat (limited to 'bencode')
-rw-r--r--bencode/bencode.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/bencode/bencode.go b/bencode/bencode.go
index 8d65701..575eb00 100644
--- a/bencode/bencode.go
+++ b/bencode/bencode.go
@@ -254,8 +254,8 @@ func parseString(data []byte) (string, int) {
panic("not a string")
}
i := bytes.IndexByte(data, ':')
- if i < 0 {
- panic("not a string, separator missing")
+ if i < 0 || i > 20 { // len(18446744073709551615) == 20 (MaxUint64)
+ panic("separator missing")
}
size, err := strconv.Atoi(string(data[:i]))
if err != nil {