-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Luacontroller: Revert function stripping from digiline messages
- Loading branch information
Showing
2 changed files
with
5 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,9 +278,11 @@ local function get_digiline_send(pos) | |
return false | ||
end | ||
|
||
-- No sending functions over the wire and make sure serialized version | ||
-- of the data is not insanely long to prevent DoS-like attacks | ||
msg = mesecon.tablecopy_stripfunctions(msg) | ||
-- It is technically possible to send functions over the wire since | ||
-- the high performance impact of stripping those from the data has | ||
-- been decided to not be worth the added realism. | ||
-- Make sure serialized version of the data is not insanely long to | ||
-- prevent DoS-like attacks | ||
local msg_ser = minetest.serialize(msg) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Jeija
Author
Collaborator
|
||
if #msg_ser > mesecon.setting("luacontroller_digiline_maxlen", 50000) then | ||
return false | ||
|
Doesn’t this impact performance too? Serialization should take even more time than mere copying. I could write a function that measures (approximately, like this solution) memory usage in a similar way, just not creating the resulting string; that should be significantly faster (if that is necessary).