Skip to content

CAN 收包,避免 8 字节缓冲的 bug - #12076

Merged
Rbb666 merged 1 commit into
RT-Thread:masterfrom
cms19859230182-lang:fix/swm341-can-dlc-bounds
Nov 24, 2026
Merged

Rbb666 merged 1 commit into
RT-Thread:masterfrom
cms19859230182-lang:fix/swm341-can-dlc-bounds

Conversation

@cms19859230182-lang

Copy link
Copy Markdown
Contributor

为什么提交此 PR

SWM341 收 classic CAN 时,硬件 DLC 可能大于 8,驱动却按这个长度往固定 8 字节缓冲里拷,CAN_Receive 和 swm_can_recvmsg 都会打穿。

Fix #11425

改动内容

两处拷贝前把长度限制在 8 字节内。

@github-actions

Copy link
Copy Markdown

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • Use workflow from 保持默认分支(通常为 master)
    Keep the default branch (usually master) in Use workflow from
  • 在 branch 输入框填写 PR 分支 fix/swm341-can-dlc-bounds
    Enter PR branch fix/swm341-can-dlc-bounds in the branch field
  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将作为独立提交推送至你的分支。
    The formatting changes will be pushed to your branch as a separate commit.

完成后,提交将自动更新至 fix/swm341-can-dlc-bounds 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the fix/swm341-can-dlc-bounds branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions Bot added the BSP label Nov 20, 2026
@Rbb666
Rbb666 merged commit 1103c13 into RT-Thread:master Nov 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Security-related Bug: SWM341 CAN receive path trusts raw DLC and writes past fixed receive buffers

2 participants