From 7fb40e104a705863ad1f25a3426279db2e6b10d8 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Fri, 15 Jan 2021 11:00:39 +0300 Subject: [PATCH] io: allow to restrict string size --- pkg/io/binaryReader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/io/binaryReader.go b/pkg/io/binaryReader.go index b8c935c80..6915f5109 100644 --- a/pkg/io/binaryReader.go +++ b/pkg/io/binaryReader.go @@ -193,7 +193,7 @@ func (r *BinReader) ReadBytes(buf []byte) { } // ReadString calls ReadVarBytes and casts the results as a string. -func (r *BinReader) ReadString() string { - b := r.ReadVarBytes() +func (r *BinReader) ReadString(maxSize ...int) string { + b := r.ReadVarBytes(maxSize...) return string(b) }