From 94a20e30e1a284f13c3f6b4b2724871081403e8b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 17 Jun 2019 16:56:16 -0700 Subject: [PATCH] lnrpc/walletrpc: reject nil outpoints as args In this commit, we modify the parsing of user provided outpoints to ensure that we catch a nil (empty) output early. Otherwise, passing a set of incorrect arguments would cause `lnd` to crash. --- lnrpc/walletrpc/walletkit_server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnrpc/walletrpc/walletkit_server.go b/lnrpc/walletrpc/walletkit_server.go index 99100a7f..4b3a26c6 100644 --- a/lnrpc/walletrpc/walletkit_server.go +++ b/lnrpc/walletrpc/walletkit_server.go @@ -420,6 +420,10 @@ func (w *WalletKit) PendingSweeps(ctx context.Context, // unmarshallOutPoint converts an outpoint from its lnrpc type to its canonical // type. func unmarshallOutPoint(op *lnrpc.OutPoint) (*wire.OutPoint, error) { + if op == nil { + return nil, fmt.Errorf("empty outpoint provided") + } + var hash chainhash.Hash switch { case len(op.TxidBytes) == 0 && len(op.TxidStr) == 0: