1
0
Fork 0
forked from lthn/blockchain

sanity check improved

This commit is contained in:
cryptozoidberg 2025-07-19 14:48:10 +04:00
parent 6c318fc34b
commit 0e1618c496
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D

View file

@ -44,7 +44,7 @@ bool do_serialize(Archive<false> &ar, std::vector<T> &v)
v.clear();
// very basic sanity check
if (ar.remaining_bytes() < cnt) {
if (ar.remaining_bytes() < (cnt * sizeof(T)) ) {
ar.stream().setstate(std::ios::failbit);
return false;
}