From f980bc38f10c6949909ab9f48b5a7d08af2842c6 Mon Sep 17 00:00:00 2001 From: GameXG Date: Wed, 7 Apr 2021 10:41:31 +0800 Subject: [PATCH] fix #5179 extractPaymentIntent null pointer payIntent.paymentAddr has not been initialized. --- rpcserver.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index dc76be02..5c299c4f 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3096,7 +3096,7 @@ func (r *rpcServer) PendingChannels(ctx context.Context, return nil, err } - resp.TotalLimboBalance += int64(forceClose.LimboBalance) + resp.TotalLimboBalance += forceClose.LimboBalance resp.PendingForceClosingChannels = append( resp.PendingForceClosingChannels, @@ -4311,6 +4311,10 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme if len(rpcPayReq.PaymentAddr) != 0 && len(rpcPayReq.PaymentAddr) != 32 { return payIntent, errors.New("invalid payment address length") } + + if payIntent.paymentAddr == nil { + payIntent.paymentAddr = &[32]byte{} + } copy(payIntent.paymentAddr[:], rpcPayReq.PaymentAddr) // Otherwise, If the payment request field was not specified