aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/binary_archive.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-11 23:36:17 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-14 08:47:14 +0000
commitdb2b9fba651670a9c8f86c316f36bc9d9dbb82cc (patch)
treedaa572cd74321fab5fcf6e861ea284fc8a38c434 /src/serialization/binary_archive.h
parentcryptonote_protocol: fix another potential P2P DoS (diff)
downloadmonero-db2b9fba651670a9c8f86c316f36bc9d9dbb82cc.tar.xz
serialization: fail on read_varint error
Diffstat (limited to 'src/serialization/binary_archive.h')
-rw-r--r--src/serialization/binary_archive.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/serialization/binary_archive.h b/src/serialization/binary_archive.h
index a0e4eff9d..9f60cf311 100644
--- a/src/serialization/binary_archive.h
+++ b/src/serialization/binary_archive.h
@@ -146,7 +146,8 @@ struct binary_archive<false> : public binary_archive_base<std::istream, false>
void serialize_uvarint(T &v)
{
typedef std::istreambuf_iterator<char> it;
- tools::read_varint(it(stream_), it(), v); // XXX handle failure
+ if (tools::read_varint(it(stream_), it(), v) < 0)
+ stream_.setstate(std::ios_base::failbit);
}
void begin_array(size_t &s)