diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-06-14 16:08:58 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-06-14 16:08:59 +0200 |
commit | c58255ec12491dbc4d8c363280ede7869f447bf9 (patch) | |
tree | 7301d251061d44106b1cc5a50778c8a1db86d230 /src/serialization | |
parent | Merge pull request #5633 (diff) | |
parent | rpc: restrict the recent cutoff size in restricted RPC mode (diff) | |
download | monero-c58255ec12491dbc4d8c363280ede7869f447bf9.tar.xz |
Merge pull request #5640
542cab02 rpc: restrict the recent cutoff size in restricted RPC mode (moneromooo-monero)
434e617a ensure no NULL is passed to memcpy (moneromooo-monero)
279f1f2c abstract_tcp_server2: improve DoS resistance (moneromooo-monero)
756773e5 serialization: check stream good flag at the end (moneromooo-monero)
e3f714aa tree-hash: allocate variable memory on heap, not stack (moneromooo-monero)
67baa3a6 cryptonote: throw on tx hash calculation error (moneromooo-monero)
d6bb9ecc serialization: fail on read_varint error (moneromooo-monero)
19490e44 cryptonote_protocol: fix another potential P2P DoS (moneromooo-monero)
fa4aa47e cryptonote_protocol: expand basic DoS protection (moneromooo-monero)
3c953d53 cryptonote_protocol_handler: prevent potential DoS (anonimal)
b873b69d epee: basic sanity check on allocation size from untrusted source (moneromooo-monero)
Diffstat (limited to 'src/serialization')
-rw-r--r-- | src/serialization/binary_archive.h | 3 | ||||
-rw-r--r-- | src/serialization/serialization.h | 2 |
2 files changed, 3 insertions, 2 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) diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h index 007bf265f..553e9951f 100644 --- a/src/serialization/serialization.h +++ b/src/serialization/serialization.h @@ -212,7 +212,7 @@ inline bool do_serialize(Archive &ar, bool &v) * \brief self-explanatory */ #define END_SERIALIZE() \ - return true; \ + return ar.stream().good(); \ } /*! \macro VALUE(f) |