TRACE handler reads past the received payload when hop size exceeds remaining data
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- networking
调研方向
从 src/Mesh.cpp 中 Mesh::onRecvPacket 的 TRACE 分支开始,在 isHashMatch 读取数据包之前,将剩余 payload 长度与 hop 大小进行比较。报告包含一个可复现的案例:3 字节路径模式,flags 声明 hop 为 4 字节,但只有 3 个哈希字节。检查现有的 TRACE 测试,或为该案例补充测试;完成标准是接收方不读取超出 payload_len 的内容,并一致地处理格式错误的 trace。
由索引模型根据 Issue 内容生成。
描述
Firmware: repeater-v1.18.0 (81dbae5), same code on current main
Description
In Mesh::onRecvPacket (src/Mesh.cpp), the TRACE branch checks:
uint8_t len = pkt->payload_len - i;
uint16_t offset = (uint16_t)pkt->path_len << path_sz;
if (offset >= len) {
onTraceRecv(...);
} else if (self_id.isHashMatch(&pkt->payload[i + offset], 1 << path_sz) && ...) {
There is no check that len - offset >= (1 << path_sz). If a TRACE's flags declare a larger hop size than the data actually carries, isHashMatch compares bytes beyond payload_len. Those bytes are stale contents of the packet buffer, so the forward decision becomes nondeterministic.
How it shows up
A third-party companion (Wadamesh, T-Deck) in 3-byte path mode sends TRACE with flags = 2 (4-byte hops) and only 3 hash bytes. Against a 1.18 repeater, the first trace was not forwarded; later identical traces (10/10) were. That matches a stale 4th byte that sometimes equals the repeater's pub_key[3]. The sender is wrong too (ALLFATHER-BV/wadamesh#818), but the receiver should not depend on undefined memory.
Suggested fix
uint8_t hsz = 1 << path_sz;
if (offset >= len) {
onTraceRecv(...);
} else if (len - offset >= hsz &&
self_id.isHashMatch(&pkt->payload[i + offset], hsz) && ...) {
Optionally treat len % hsz != 0 as malformed and drop the packet.
- 主要语言
- C
- 星标
- 3.9k
- 派生
- 1.5k
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 34
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
meshcore-dev/MeshCore 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
meshcore-dev/MeshCore#3760 · 3 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
meshcore-dev/MeshCore#3698 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
meshcore-dev/MeshCore#3622 ·
维护者通常 2 天内回复
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash size未关闭
难度 2/5 1-3 小时 新手友好度 62/100
meshcore-dev/MeshCore#3571 · 5 个 reaction ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
meshcore-dev/MeshCore#3567 · 1 条评论 ·
维护者通常 2 天内回复
查看 meshcore-dev/MeshCore 的全部 Issue
相似的 Issue
-
kind/bug priority/medium qa_automation
难度 2/5 1-3 小时 新手友好度 78/100
yugabyte/yugabyte-db#37324 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 80/100
ly05010419/MacNativeGames#1897 ·
维护者通常 1 天内回复
-
area: metrics area: tracing contribfest enhancement good first issue
难度 2/5 1-3 小时 新手友好度 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4188 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
FujiNetWIFI/fujinet-firmware#2328 ·
维护者通常 1 天内回复