io: allow to restrict string size

This commit is contained in:
Evgeniy Stratonikov 2021-01-15 11:00:39 +03:00
parent 376c22adee
commit 7fb40e104a

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