From f7436f43b23a724e18c92d0c60f844f33e14af4a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 13 Sep 2018 15:56:21 -0700 Subject: [PATCH] lnwire: check length of payload in decodeShortChanIDs --- lnwire/query_short_chan_ids.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnwire/query_short_chan_ids.go b/lnwire/query_short_chan_ids.go index 66b3c3d62..68cea1932 100644 --- a/lnwire/query_short_chan_ids.go +++ b/lnwire/query_short_chan_ids.go @@ -112,6 +112,10 @@ func decodeShortChanIDs(r io.Reader) (ShortChanIDEncoding, []ShortChannelID, err return 0, nil, err } + if numBytesResp == 0 { + return 0, nil, fmt.Errorf("No encoding type specified") + } + queryBody := make([]byte, numBytesResp) if _, err := io.ReadFull(r, queryBody); err != nil { return 0, nil, err