From 8eba3c1edcfa8418b9de3e9b3391909a17107969 Mon Sep 17 00:00:00 2001 From: yangwei_814916 Date: Tue, 28 Feb 2023 14:57:17 +0800 Subject: [PATCH] check json Signed-off-by: yangwei_814916 --- .../screenservice/sourceservice/dscreenmgr/src/dscreen.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp index eaef12e4..9ca8cc8f 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/dscreen.cpp @@ -195,6 +195,10 @@ void DScreen::HandleEnable(const std::string ¶m, const std::string &taskId) } json attrJson = json::parse(param, nullptr, false); + if (attrJson.is_discarded()) { + DHLOGE("HandleEnable attrJson is invalid"); + return; + } int32_t ret = CheckJsonData(attrJson); if (ret != DH_SUCCESS) { DHLOGE("check json data failed."); -- Gitee