mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-20 23:55:24 -04:00
@@ -172,7 +172,7 @@ static uint8_t DeserializeInnerBundleName(IOwner owner, IpcIo *reply)
|
||||
info->resultCode = ERR_APPEXECFWK_DESERIALIZATION_FAILED;
|
||||
return ERR_APPEXECFWK_DESERIALIZATION_FAILED;
|
||||
}
|
||||
if (length < 0 || length > MAX_BUNDLE_NAME) {
|
||||
if (length > MAX_BUNDLE_NAME) {
|
||||
info->resultCode = ERR_APPEXECFWK_DESERIALIZATION_FAILED;
|
||||
return ERR_APPEXECFWK_DESERIALIZATION_FAILED;
|
||||
}
|
||||
|
||||
@@ -330,13 +330,10 @@ bool BundleInstaller::MatchPermissions(const std::vector<std::string> & restrict
|
||||
|
||||
int32_t size = realRestrictedPermissions.size();
|
||||
for (int32_t i = 0; i < size; i++) {
|
||||
bool isMatched = false;
|
||||
for (const auto & restrictedPermission : restrictedPermissions) {
|
||||
if (realRestrictedPermissions[i] == restrictedPermission) {
|
||||
isMatched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isMatched = std::any_of(restrictedPermissions.begin(), restrictedPermissions.end(),
|
||||
[realRestrictedPermissions, i](const auto & restrictedPermission)->bool {
|
||||
return realRestrictedPermissions[i] == restrictedPermission;
|
||||
});
|
||||
if (!isMatched) {
|
||||
HILOG_WARN(HILOG_MODULE_APP, "provisionPermissions is not match the bundle reqPermissions!");
|
||||
return false;
|
||||
|
||||
@@ -672,10 +672,9 @@ static int32_t GenerateInnerUid(std::map<int, std::string> &innerMap, const std:
|
||||
}
|
||||
int32_t ret = 0;
|
||||
for (int32_t i = 0; i < innerMap.rbegin()->first; ++i) {
|
||||
if (innerMap.find(i) == innerMap.end()) {
|
||||
innerMap.emplace(i, bundleName);
|
||||
ret = i + baseUid;
|
||||
return ret;
|
||||
auto res = innerMap.emplace(i, bundleName);
|
||||
if (res.second) {
|
||||
return i + baseUid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +122,6 @@ BOOL BundleMsFeature::OnFeatureMessage(Feature *feature, Request *request)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void InnerFreeDataBuff(void *ptr)
|
||||
{
|
||||
if (ptr != nullptr) {
|
||||
cJSON_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t BundleMsFeature::HasSystemCapability(const uint8_t funcId, IpcIo *req, IpcIo *reply)
|
||||
{
|
||||
if ((req == nullptr) || (reply == nullptr)) {
|
||||
|
||||
@@ -109,7 +109,7 @@ char *GtBundleExtractor::ExtractHapProfile(int32_t fp, uint32_t totalFileSize)
|
||||
}
|
||||
|
||||
int32_t fileNameLen = strlen(fileName);
|
||||
if (pathLen == 0 && (fileName != nullptr && strcmp(fileName, PROFILE_NAME) == 0)) {
|
||||
if (pathLen == 0 && (strcmp(fileName, PROFILE_NAME) == 0)) {
|
||||
UI_Free(fileName);
|
||||
fileName = nullptr;
|
||||
fileData = reinterpret_cast<char *>(AdapterMalloc(fileSize * sizeof(char)));
|
||||
|
||||
@@ -109,8 +109,7 @@ uint8_t GtBundleInstaller::VerifySignature(const char *path, SignatureInfo &sign
|
||||
VerifyResult verifyResult;
|
||||
// verify signature
|
||||
(void) APPVERI_SetDebugMode(true);
|
||||
int32_t ret = (bundleStyle == THIRD_APP_FLAG) ? APPVERI_AppVerify(path, &verifyResult) :
|
||||
APPVERI_AppVerify(path, &verifyResult);
|
||||
int32_t ret = APPVERI_AppVerify(path, &verifyResult);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] APPVERI_AppVerify is %d", ret);
|
||||
uint8_t errorCode = SwitchErrorCode(ret);
|
||||
if (errorCode != ERR_OK) {
|
||||
@@ -523,9 +522,6 @@ uint8_t GtBundleInstaller::UpdateBundleInfo(uint8_t bundleStyle, uint32_t labelI
|
||||
if (bundleStyle == SYSTEM_APP_FLAG) {
|
||||
bundleInfo->isSystemApp = true;
|
||||
GtManagerService::GetInstance().AddBundleInfo(bundleInfo);
|
||||
} else if (bundleStyle == THIRD_SYSTEM_APP_FLAG) {
|
||||
bundleInfo->isSystemApp = false;
|
||||
GtManagerService::GetInstance().AddBundleInfo(bundleInfo);
|
||||
} else {
|
||||
bundleInfo->isSystemApp = false;
|
||||
GtManagerService::GetInstance().AddBundleInfo(bundleInfo);
|
||||
|
||||
@@ -317,6 +317,9 @@ void GtManagerService::InstallAllSystemBundle(InstallerCallback installerCallbac
|
||||
AppInfoList *currentNode = nullptr;
|
||||
AppInfoList *nextNode = nullptr;
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, AppInfoList, appDoubleList) {
|
||||
if (currentNode == nullptr) {
|
||||
return;
|
||||
}
|
||||
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
|
||||
continue;
|
||||
@@ -411,10 +414,12 @@ void GtManagerService::RemoveSystemAppPathList(List<ToBeInstalledApp *> *systemP
|
||||
|
||||
for (auto node = systemPathList->Begin(); node != systemPathList->End(); node = node->next_) {
|
||||
ToBeInstalledApp *toBeInstalledApp = node->value_;
|
||||
AdapterFree(toBeInstalledApp->installedPath);
|
||||
AdapterFree(toBeInstalledApp->path);
|
||||
AdapterFree(toBeInstalledApp->appId);
|
||||
UI_Free(toBeInstalledApp);
|
||||
if (toBeInstalledApp != nullptr) {
|
||||
AdapterFree(toBeInstalledApp->installedPath);
|
||||
AdapterFree(toBeInstalledApp->path);
|
||||
AdapterFree(toBeInstalledApp->appId);
|
||||
UI_Free(toBeInstalledApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,6 +438,9 @@ void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInst
|
||||
AppInfoList *nextNode = nullptr;
|
||||
|
||||
LOS_DL_LIST_FOR_EACH_ENTRY_SAFE(currentNode, nextNode, &list->appDoubleList, AppInfoList, appDoubleList) {
|
||||
if (currentNode == nullptr) {
|
||||
return;
|
||||
}
|
||||
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
|
||||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
|
||||
continue;
|
||||
@@ -696,6 +704,9 @@ void GtManagerService::RemoveBundleResList(const char *bundleName)
|
||||
|
||||
for (auto node = bundleResList_->Begin(); node != bundleResList_->End(); node = node->next_) {
|
||||
BundleRes *res = node->value_;
|
||||
if (res == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (res->bundleName != nullptr && strcmp(bundleName, res->bundleName) == 0) {
|
||||
AdapterFree(res->abilityRes);
|
||||
AdapterFree(res);
|
||||
@@ -997,6 +1008,9 @@ void GtManagerService::APP_QueryAppInfo(const char *appDir, AppInfoList *list)
|
||||
return;
|
||||
}
|
||||
char *fileName = reinterpret_cast<char *>(AdapterMalloc(MAX_NAME_LEN + 1));
|
||||
if (fileName == nullptr) {
|
||||
return;
|
||||
}
|
||||
while ((ent = readdir(dir)) != nullptr) {
|
||||
if (memset_s(fileName, MAX_NAME_LEN + 1, 0, MAX_NAME_LEN + 1) != EOK) {
|
||||
break;
|
||||
@@ -1029,6 +1043,7 @@ void GtManagerService::APP_QueryAppInfo(const char *appDir, AppInfoList *list)
|
||||
APP_InsertAppInfo(appPath, (AppInfoList *)&list->appDoubleList);
|
||||
AdapterFree(appPath);
|
||||
}
|
||||
closedir(dir);
|
||||
AdapterFree(fileName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user