minetest.deserialize: Throw error when argument not string (#5738)

This commit is contained in:
SmallJoker 2017-05-09 23:11:20 +02:00 committed by Nils Dagsson Moskopp
parent 6fa4c1f2d0
commit 88c24db1a7
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 4 additions and 0 deletions

View File

@ -186,6 +186,10 @@ local safe_env = {
}
function core.deserialize(str, safe)
if type(str) ~= "string" then
return nil, "Cannot deserialize type '"..type(str)
.."'. Argument must be a string."
end
if str:byte(1) == 0x1B then
return nil, "Bytecode prohibited"
end