完善解码保护,联网收到非法消息不会爆炸了

This commit is contained in:
MrZ626
2021-02-17 02:44:20 +08:00
parent 8421d2e03c
commit 76070d195e
4 changed files with 30 additions and 10 deletions

View File

@@ -212,8 +212,15 @@ local function loadGameEnv(P)--Load gameEnv
end
end
end
local function loadRemoteEnv(P,conf)--Load gameEnv
conf=conf and json.decode(love.data.decode("string","base64",conf))or{}
local function loadRemoteEnv(P,confStr)--Load gameEnv
local _,conf=pcall(love.data.decode,"string","base64",confStr)
if _ then
conf=json.decode(conf)
else
conf={}
LOG.print("Bad conf from "..P.userName.."#"..P.userID)
end
P.gameEnv={}--Current game setting environment
local ENV=P.gameEnv
local GAME,SETTING=GAME,SETTING