mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-17 15:11:21 +00:00
Limit binary data to 21MB
This commit is contained in:
@ -2,10 +2,16 @@ package binary
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// TODO document and maybe make it configurable.
|
||||
const MaxBinaryReadSize = 21 * 1024 * 1024
|
||||
|
||||
var ErrMaxBinaryReadSizeReached = errors.New("Error: max binary read size reached")
|
||||
|
||||
func ReadBinary(o interface{}, r io.Reader, n *int64, err *error) interface{} {
|
||||
rv, rt := reflect.ValueOf(o), reflect.TypeOf(o)
|
||||
if rv.Kind() == reflect.Ptr {
|
||||
|
Reference in New Issue
Block a user