Skip to content

Commit fa18038

Browse files
author
MarcoFalke
committed
refactor: Use ignore helper when unserializing an invalid pubkey
1 parent fabe18d commit fa18038

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/pubkey.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,15 @@ class CPubKey
141141
template <typename Stream>
142142
void Unserialize(Stream& s)
143143
{
144-
unsigned int len = ::ReadCompactSize(s);
144+
const unsigned int len(::ReadCompactSize(s));
145145
if (len <= SIZE) {
146146
s.read((char*)vch, len);
147147
if (len != size()) {
148148
Invalidate();
149149
}
150150
} else {
151151
// invalid pubkey, skip available data
152-
char dummy;
153-
while (len--)
154-
s.read(&dummy, 1);
152+
s.ignore(len);
155153
Invalidate();
156154
}
157155
}

0 commit comments

Comments
 (0)