From 082557b7d4614527e2fbfbcc086b146fed622227 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 24 Jul 2018 21:25:47 -0400 Subject: [PATCH] rpc: validate height in abci_query --- rpc/core/abci.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rpc/core/abci.go b/rpc/core/abci.go index a5eede3fc..100176195 100644 --- a/rpc/core/abci.go +++ b/rpc/core/abci.go @@ -1,10 +1,12 @@ package core import ( + "fmt" + abci "github.com/tendermint/tendermint/abci/types" + cmn "github.com/tendermint/tendermint/libs/common" ctypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/tendermint/tendermint/version" - cmn "github.com/tendermint/tendermint/libs/common" ) // Query the application for some information. @@ -48,6 +50,10 @@ import ( // | height | int64 | 0 | false | Height (0 means latest) | // | trusted | bool | false | false | Does not include a proof of the data inclusion | func ABCIQuery(path string, data cmn.HexBytes, height int64, trusted bool) (*ctypes.ResultABCIQuery, error) { + if height < 0 { + return nil, fmt.Errorf("height must be non-negative") + } + resQuery, err := proxyAppQuery.QuerySync(abci.RequestQuery{ Path: path, Data: data,