已开启
fix: add null pointer check for profile content buffer #345
wangtiantian创建于 7月14日
fix: add null pointer check for profile content buffer #345
已开启
wangtiantian创建于 7月14日
wangtiantian
wangtiantian成员
7月14日

Fix Description

Problem

Missing null pointer check for profilePkcs7Context.content.GetBufferPtr() in HapProfileVerifyUtils::ParseProfile function, which may cause null pointer dereference risk.

Solution

  • Add null pointer check for profilePkcs7Context.content.GetBufferPtr() in ParseProfile function
  • Check if pointer is nullptr and length is valid before using content buffer
  • Add corresponding test cases to verify the new validation logic
  • Improve code robustness and prevent potential null pointer dereference

Closes #199

Modified Files

  • interfaces/innerkits/appverify/src/util/hap_profile_verify_utils.cpp - Add null pointer check
  • interfaces/innerkits/appverify/test/unittest/src/hap_profile_verify_utils_test.cpp - Add test cases

Test Verification

Added 3 new test cases to cover the new null pointer check logic:

  • ParseProfileTest004: Test invalid PKCS7 data handling
  • ParseProfileTest005: Test malformed PKCS7 data edge cases
  • ParseProfileTest006: Test APP_GALLARY source with empty content validation

Co-Authored-By: Claude noreply@anthropic.com

likedislike
合并受阻
wangtiantianwangtiantian成员
7月14日 关联了issue:代码检视意见修改
openharmony_ciopenharmony_ci成员
7月14日 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
7月14日 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
openharmony_ciopenharmony_ci成员
7月14日 添加了label:dco检查失败
wangtiantianwangtiantian成员
7月14日 修改了pull request 的描述
openharmony_dcp
openharmony_dcp成员
8月9日 评论:

您好, @wang19954 该PR需要您响应,已过去25天未响应,请根据检视意见进行修改,如5天内未响应检视意见,此PR会被自动关闭。关闭后的PR,如有需要,您可以自行打开该PR。

likedislike