已合并
fix: validate pkgName length at IPC stub boundary #12462
fix: validate pkgName length at IPC stub boundary #12462
已合并
Farmer_Joe创建于 8月27日
Farmer_Joe
Farmer_Joe
8月27日

相关的Issue

https://gitcode.com/openharmony/communication_dsoftbus/issues/9740

原因(目的、解决的问题等)

部分 IPC 处理函数对 pkgName 做了 strnlen(pkgName, PKG_NAME_SIZE_MAX) 长度上界校验,另一些只判 nullptr(或 nullptr+strlen==0),校验不一致。未做上界校验的入口允许超长 pkgName 越过 IPC 边界,而服务层大量使用定长 char pkgNamePKG_NAME_SIZE_MAX缓冲,存在潜在溢出风险。本次统一在 IPC 边界补齐长度上界,做纵深防御。

描述(做了什么,变更了什么)

在 17 处 pkgName 读取点追加 strnlen(pkgName, PKG_NAME_SIZE_MAX) >= PKG_NAME_SIZE_MAX(或宏式 && strnlen(...) < PKG_NAME_SIZE_MAX)校验,沿用各函数既有判空 idiom 与返回码,正常路径(合法 pkgName)行为不变。

验证结果(新增、改动、可能影响的功能)

日志规范自检:

安全编码自检:

是否已执行L0用例

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 Farmer_Joe 的贡献)
openharmony_ciopenharmony_ci成员
8月27日 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
8月27日 评论:

感谢提交 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成员
8月27日 添加了label:dco检查成功
Farmer_Joe
Farmer_Joe
8月31日 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
8月31日 评论:

该提交没有关联任何Issue,请先关联一个Issue后再触发构建
The PR is not associated with any Issue, Please associate the PR with one Issue before trigger build.

likedislike
此处折叠了117条消息 查看更多
openharmony_ci
openharmony_ci成员
9月29日 评论:

您好,Committer @byx0010 @chen-botong @jzy_123 @zhang-haowen123 @michael4096 @jeosif @liangliang_ma @firstsummer @songzhengteng @tanyanying @wangJE ,请分配检视人员检视该PR,可以通过命令"assign [@someone_id]"分配检视人员,也可以直接评论"assign"分配给自己进行检视。


Hello, Committer @byx0010 @chen-botong @jzy_123 @zhang-haowen123 @michael4096 @jeosif @liangliang_ma @firstsummer @songzhengteng @tanyanying @wangJE . Please assign someone to review the PR. You can assign a reviewer by using the command "assign [@someone_id]", or you can comment "assign" to review the PR by yourself.

likedislike
openharmony_ciopenharmony_ci成员
9月29日 关闭了关联的issue
openharmony_ciopenharmony_ci成员
9月29日 合入了pull request,合并节点 SHA:15b7fb91a405161c78159a4043798897919f49cf
openharmony_ciopenharmony_ci成员
9月29日 删除了label:waiting_for_review
openharmony_ciopenharmony_ci成员
9月29日 添加了label:merged