Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mesecons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
mesecons
Commits
54daee23
Commit
54daee23
authored
8 years ago
by
Jeija
Browse files
Options
Downloads
Patches
Plain Diff
Luacontroller: Revert function stripping from digiline messages
parent
c2e3d7c4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mesecons/util.lua
+0
-18
0 additions, 18 deletions
mesecons/util.lua
mesecons_luacontroller/init.lua
+5
-3
5 additions, 3 deletions
mesecons_luacontroller/init.lua
with
5 additions
and
21 deletions
mesecons/util.lua
+
0
−
18
View file @
54daee23
...
...
@@ -151,24 +151,6 @@ function mesecon.tablecopy(table) -- deep table copy
return
newtable
end
function
mesecon
.
tablecopy_stripfunctions
(
table
)
-- deep table copy, but remove all functions
if
type
(
table
)
==
"function"
then
return
nil
end
-- functions become nil
if
type
(
table
)
~=
"table"
then
return
table
end
-- no need to copy
local
newtable
=
{}
for
idx
,
item
in
pairs
(
table
)
do
if
type
(
idx
)
~=
"function"
then
if
type
(
item
)
==
"table"
then
newtable
[
idx
]
=
mesecon
.
tablecopy_stripfunctions
(
item
)
elseif
type
(
item
)
~=
"function"
then
newtable
[
idx
]
=
item
end
end
end
return
newtable
end
function
mesecon
.
cmpAny
(
t1
,
t2
)
if
type
(
t1
)
~=
type
(
t2
)
then
return
false
end
if
type
(
t1
)
~=
"table"
and
type
(
t2
)
~=
"table"
then
return
t1
==
t2
end
...
...
This diff is collapsed.
Click to expand it.
mesecons_luacontroller/init.lua
+
5
−
3
View file @
54daee23
...
...
@@ -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
)
if
#
msg_ser
>
mesecon
.
setting
(
"luacontroller_digiline_maxlen"
,
50000
)
then
return
false
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment