summaryrefslogtreecommitdiff
path: root/src/serialization.h
diff options
context:
space:
mode:
authorBen Deutsch <ben@bendeutsch.de>2018-01-30 22:12:40 +0100
committersfan5 <sfan5@live.de>2020-02-01 14:05:26 +0100
commit2b3490db1f0e99a427e34135770f8e5afcf275ce (patch)
tree8da1c031def8d582ba2ce7b79002811e150c1808 /src/serialization.h
parent1116918dbbbf7f36920c6d43a4fc504a09f0df49 (diff)
downloadminetest-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.h2
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);