From 002f2c1a470c25aa3cc0163b13c026077453afce Mon Sep 17 00:00:00 2001 From: Amaury M <1293565+amaurym@users.noreply.github.com> Date: Thu, 22 Jul 2021 19:42:56 +0200 Subject: [PATCH] Check wireType too --- x/auth/tx/decoder.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/auth/tx/decoder.go b/x/auth/tx/decoder.go index d1b753cf23df..d93c7446db60 100644 --- a/x/auth/tx/decoder.go +++ b/x/auth/tx/decoder.go @@ -101,11 +101,13 @@ func rejectNonADR027(txBytes []byte) error { prevTagNum := protowire.Number(0) for len(txBytes) > 0 { - tagNum, _, m := protowire.ConsumeTag(txBytes) + tagNum, wireType, m := protowire.ConsumeTag(txBytes) if m < 0 { return fmt.Errorf("invalid length; %w", protowire.ParseError(m)) } - + if wireType != protowire.BytesType { + return fmt.Errorf("expected %d wire type, got %d", protowire.VarintType, wireType) + } if tagNum < prevTagNum { return fmt.Errorf("txRaw must follow ADR-027, got tagNum %d after tagNum %d", tagNum, prevTagNum) }