io: allow to restrict string size

This commit is contained in:
Evgeniy Stratonikov 2021-01-15 11:00:39 +03:00 committed by Roman Khimov
parent 89fb02a7f8
commit feb6ba2ef7

View file

@ -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)
}