diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-29 23:55:51 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-29 23:55:51 +0800 |
commit | fd27f074feecec2f1e4c8041ff04ddac8d0ab6a3 (patch) | |
tree | b8e134548c06002421c776adf35a69758340a665 /rpc/api/eth_args.go | |
parent | 8202bae070ae80db572dc37895e52f3e4e75585b (diff) | |
parent | c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e (diff) | |
download | dexon-fd27f074feecec2f1e4c8041ff04ddac8d0ab6a3.tar.gz dexon-fd27f074feecec2f1e4c8041ff04ddac8d0ab6a3.tar.zst dexon-fd27f074feecec2f1e4c8041ff04ddac8d0ab6a3.zip |
Merge pull request #1945 from bas-vk/rpcparsing
Argument parsing can lead to panic in rpc channel
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r-- | rpc/api/eth_args.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 6aca6a663..457350d74 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -626,7 +626,12 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) { args.IncludeTxs = obj[1].(bool) - return nil + if inclTx, ok := obj[1].(bool); ok { + args.IncludeTxs = inclTx + return nil + } + + return shared.NewInvalidTypeError("includeTxs", "not a bool") } type GetBlockByNumberArgs struct { @@ -648,9 +653,12 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) { return err } - args.IncludeTxs = obj[1].(bool) + if inclTx, ok := obj[1].(bool); ok { + args.IncludeTxs = inclTx + return nil + } - return nil + return shared.NewInvalidTypeError("includeTxs", "not a bool") } type BlockFilterArgs struct { |