From 2499b1b139d82f2f266ce9c79aebca1568396a51 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 11 Dec 2017 22:47:10 +0100 Subject: rlp: fix string size check in readKind (#15625) Issue found by @guidovranken --- rlp/raw.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rlp/raw.go') diff --git a/rlp/raw.go b/rlp/raw.go index 6bf1c1df8..2b3f328f6 100644 --- a/rlp/raw.go +++ b/rlp/raw.go @@ -98,7 +98,7 @@ func readKind(buf []byte) (k Kind, tagsize, contentsize uint64, err error) { tagsize = 1 contentsize = uint64(b - 0x80) // Reject strings that should've been single bytes. - if contentsize == 1 && buf[1] < 128 { + if contentsize == 1 && len(buf) > 1 && buf[1] < 128 { return 0, 0, 0, ErrCanonSize } case b < 0xC0: -- cgit