diff options
author | Ben Deutsch <ben@bendeutsch.de> | 2018-01-30 22:12:40 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-02-01 14:05:26 +0100 |
commit | 2b3490db1f0e99a427e34135770f8e5afcf275ce (patch) | |
tree | 8da1c031def8d582ba2ce7b79002811e150c1808 /src/serialization.h | |
parent | 1116918dbbbf7f36920c6d43a4fc504a09f0df49 (diff) | |
download | minetest-2b3490db1f0e99a427e34135770f8e5afcf275ce.tar.gz minetest-2b3490db1f0e99a427e34135770f8e5afcf275ce.tar.bz2 minetest-2b3490db1f0e99a427e34135770f8e5afcf275ce.zip |
Add limit parameter to decompressZlib
This can prevent untrusted data, such as sent over the network,
from consuming all memory with a specially crafted payload.
Diffstat (limited to 'src/serialization.h')
-rw-r--r-- | src/serialization.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialization.h b/src/serialization.h index 7f8b83382..f399983c4 100644 --- a/src/serialization.h +++ b/src/serialization.h @@ -87,7 +87,7 @@ inline bool ser_ver_supported(s32 v) { void compressZlib(const u8 *data, size_t data_size, std::ostream &os, int level = -1); void compressZlib(const std::string &data, std::ostream &os, int level = -1); -void decompressZlib(std::istream &is, std::ostream &os); +void decompressZlib(std::istream &is, std::ostream &os, size_t limit = 0); // These choose between zlib and a self-made one according to version void compress(const SharedBuffer<u8> &data, std::ostream &os, u8 version); |