mirror of
https://github.com/tendermint/tendermint.git
synced 2026-06-01 03:46:22 +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