From fa18038f519db76befb9a7bd0b1540143bfeb12b Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 6 Nov 2021 19:08:29 +0100 Subject: [PATCH] refactor: Use ignore helper when unserializing an invalid pubkey --- src/pubkey.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pubkey.h b/src/pubkey.h index 861a2cf5006..ab0f429ca92 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -141,7 +141,7 @@ public: template void Unserialize(Stream& s) { - unsigned int len = ::ReadCompactSize(s); + const unsigned int len(::ReadCompactSize(s)); if (len <= SIZE) { s.read((char*)vch, len); if (len != size()) { @@ -149,9 +149,7 @@ public: } } else { // invalid pubkey, skip available data - char dummy; - while (len--) - s.read(&dummy, 1); + s.ignore(len); Invalidate(); } }