已关闭
fix: add null pointer check for profile content buffer #346
wangtiantian创建于 7月15日关闭于 20 小时前
fix: add null pointer check for profile content buffer #346
已关闭
wangtiantian创建于 7月15日关闭于 20 小时前
wangtiantian
wangtiantian成员
7月15日

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
Signed-off-by: wangtiantian wangtiantian19@huawei.com

likedislike
当前Pull Request已关闭, 关闭人@openharmony_dcp
wangtiantianwangtiantian成员
7月15日 关联了issue:代码检视意见修改
openharmony_ciopenharmony_ci成员
7月15日 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
7月15日 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
7月15日 添加了label:dco检查成功
openharmony_dcp
openharmony_dcp成员
20 小时前 评论:

您的PR超过一个月未合入,已经被自动关闭,如有需要您可以重新提交代码进行贡献。

likedislike
openharmony_dcpopenharmony_dcp成员
20 小时前 关闭了 pull request