From e26dd7bdfee46d780452dcd8743802fe5e1e854a Mon Sep 17 00:00:00 2001 From: seelabs Date: Mon, 28 Oct 2019 13:14:26 -0700 Subject: [PATCH] Reject overlong encodings earlier --- src/ripple/protocol/impl/tokens.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ripple/protocol/impl/tokens.cpp b/src/ripple/protocol/impl/tokens.cpp index 9fb6d79357..c1d0e8f85b 100644 --- a/src/ripple/protocol/impl/tokens.cpp +++ b/src/ripple/protocol/impl/tokens.cpp @@ -216,6 +216,10 @@ decodeBase58 (std::string const& s, ++psz; --remain; } + + if (remain > 64) + return {}; + // Allocate enough space in big-endian base256 representation. // log(58) / log(256), rounded up. std::vector b256(