From 14aadc8c2ecd0566fe83fe7a2ae1eb5bf63ac377 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 16 Jul 2016 17:43:27 -0700 Subject: [PATCH] cmd/lncli: add validation of address for connectpeer --- cmd/lncli/commands.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 22117c6f7..ecb0dbf24 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -152,6 +152,10 @@ func connectPeer(ctx *cli.Context) error { targetAddress := ctx.Args().Get(0) splitAddr := strings.Split(targetAddress, "@") + if len(splitAddr) != 2 { + return fmt.Errorf("target address expected in format: lnid@host:port") + } + addr := &lnrpc.LightningAddress{ PubKeyHash: splitAddr[0], Host: splitAddr[1],