From 041d6ba3f72418cff12625aa6554008f0cebc02b Mon Sep 17 00:00:00 2001 From: liuyaoqian Date: Wed, 16 Apr 2025 01:36:03 +0000 Subject: [PATCH] fix security alarms Signed-off-by: liuyaoqian --- frameworks/src/bundle_test_tool.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frameworks/src/bundle_test_tool.cpp b/frameworks/src/bundle_test_tool.cpp index 43479fd..0472e1b 100644 --- a/frameworks/src/bundle_test_tool.cpp +++ b/frameworks/src/bundle_test_tool.cpp @@ -1376,10 +1376,7 @@ ErrCode BundleTestTool::RunAsCheckCommand() return OHOS::ERR_INVALID_VALUE; } if (option == -1) { - // When scanning the first argument if ((counter == 1) && (strcmp(argv_[optind], cmd_.c_str()) == 0)) { - // 'CheckAbilityEnableInstall' with no option: CheckAbilityEnableInstall - // 'CheckAbilityEnableInstall' with a wrong argument: CheckAbilityEnableInstall APP_LOGD("'CheckAbilityEnableInstall' with no option."); return OHOS::ERR_INVALID_VALUE; } @@ -1403,7 +1400,9 @@ ErrCode BundleTestTool::RunAsCheckCommand() break; } case 'u': { - userId = std::stoi(optarg); + if (!OHOS::StrToInt(optarg, userId)) { + APP_LOGD("userId strToInt failed"); + } break; } default: { -- Gitee