From 0214d83aa5fd53bae81d9e66ddb30609d0055b76 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 20 Feb 2020 15:51:31 -0500 Subject: [PATCH] Improve handling of empty buffer in varint parsing (RIPD-1683) --- src/ripple/nodestore/impl/varint.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ripple/nodestore/impl/varint.h b/src/ripple/nodestore/impl/varint.h index e74f53afd5..75d8e58a75 100644 --- a/src/ripple/nodestore/impl/varint.h +++ b/src/ripple/nodestore/impl/varint.h @@ -55,6 +55,8 @@ template std::size_t read_varint(void const* buf, std::size_t buflen, std::size_t& t) { + if (buflen == 0) + return 0; t = 0; std::uint8_t const* p = reinterpret_cast(buf); std::size_t n = 0;