openharmony_ci df1053c7af !186 merge master into master
fix UAF

Created-by: kirby
Commit-by: kirby
Merged-by: openharmony_ci
Description: ### 相关的Issue

  https://gitcode.com/openharmony/customization_config_policy/issues/164
### 原因(目的、解决的问题等)

修复UAF问题
### 描述(做了什么,变更了什么)
修复UAF问题

### 测试用例(新增、改动、可能影响的功能)
    
    
### L0新增用例自检结果
- [ ] 是,有新增L0用例,且完成自检
- [√ ] 否


See merge request: openharmony/customization_config_policy!186
2026-06-04 17:17:57 +08:00
2023-11-25 17:08:39 +08:00
2025-12-18 10:12:30 +08:00
2026-06-04 09:03:31 +08:00
2025-09-18 16:25:23 +08:00
2025-12-03 11:41:41 +08:00
2022-03-07 15:57:18 +08:00
2024-05-29 15:09:06 +08:00
2022-11-15 15:14:43 +08:00

Configuration Policy Component

Introduction

The configuration policy component, namely, customization_config_policy, provides APIs for each service module to obtain the configuration directories at different levels or the configuration file paths.

System Architecture

Figure 1 Architecture of the configuration policy component

The architecture is described as follows:

  • interfaces provides the path of the file with the highest priority and all-level paths of the specified file.
  • frameworks initializes the configuration directory and queries the file path.

Directory Structure

The code directory structure of the configuration policy component is as follows:

/base/customization/
├── config_policy           # Code repository for the configuration policy component
│   ├── frameworks          # Core code of the configuration policy component
│   │   ├── config_policy   # Configuration policy module
│   │   │   └── src         # Implementation code
│   ├── interfaces          # APIs of the configuration policy component
│   │   ├── inner_api       # APIs for internal subsystems
│   │   └── kits            # JavaScript APIs of the configurationpolicy component
│   └── test                # Test code

Usage

Call the APIs of the configuration policy component to obtain the configuration directories at different levels or the configuration file paths.

#include "config_policy_utils.h"

CfgDir *cfgDir = GetCfgDirList(); // Obtain the configuration directory list.
FreeCfgDirList(cfgDir); // Release the memory after the list is obtained.

const char *cfgPath = "etc/xml/cfg.xml"; // Set the relative path and name of the configuration file.
CfgFiles *cfgFiles = GetCfgFiles(cfgPath); // Obtain the configuration file paths of all configuration levels.
FreeCfgFiles(cfgFiles); // Release the memory after the information is obtained.

const char *userPath = "etc/xml/user.xml"; // Set the relative path and name of the configuration file.
char buf[MAX_PATH_LEN] = {0};
char *filePath = GetOneCfgFile(userPath, buf, MAX_PATH_LEN); // Obtain the path of the configuration file with the highest priority.

Constraints

Programming language: C/C++

Repositories Involved

customization_config_policy

S
Description
暂无描述
Readme 1.3 MiB
Languages
C++ 74.5%
C 25.5%