From db455a328f0ac6a67720c15c5e17be72653d9e0b Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 19 Aug 2019 21:40:17 -0400 Subject: [PATCH] Correct JSON-RPC passthrough parameters The previous code would pass all parameters (including null and the empty array) as the first parameter to all passthrough requests. --- rpc/jsonrpc/methods.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpc/jsonrpc/methods.go b/rpc/jsonrpc/methods.go index 44ee09aa1..973071e73 100644 --- a/rpc/jsonrpc/methods.go +++ b/rpc/jsonrpc/methods.go @@ -197,7 +197,11 @@ func lazyApplyHandler(s *Server, ctx context.Context, request *dcrjson.Request) return nil, rpcErrorf(dcrjson.ErrRPCClientNotConnected, "RPC passthrough requires dcrd RPC synchronization") } var resp json.RawMessage - err := rpc.Call(ctx, request.Method, &resp, request.Params) + var params = make([]interface{}, len(request.Params)) + for i := range request.Params { + params[i] = request.Params[i] + } + err := rpc.Call(ctx, request.Method, &resp, params...) if ctx.Err() != nil { log.Warnf("Canceled RPC method %v invoked by %v: %v", request.Method, remoteAddr(ctx), err) return nil, &dcrjson.RPCError{