Skip to content

fix(mesh): bound the user-facing notification sprintf calls#10437

Merged
thebentern merged 2 commits into
meshtastic:developfrom
DatanoiseTV:fix/mesh-snprintf-notifications
May 9, 2026
Merged

fix(mesh): bound the user-facing notification sprintf calls#10437
thebentern merged 2 commits into
meshtastic:developfrom
DatanoiseTV:fix/mesh-snprintf-notifications

Conversation

@DatanoiseTV
Copy link
Copy Markdown
Contributor

Two sites built ClientNotification messages with sprintf into a
fixed-size proto buffer with no length cap. The current format strings
fit comfortably, but a future caller editing either format string
without rechecking the buffer size would get a silent stack/heap
overrun. Switch to snprintf with sizeof so the bound is enforced at
the call site.

Split out from #10424 per @thebentern's request — single-concern PR.

Build verification

pio run -e t-deck-tft succeeds, no new warnings.

Attestations

  • I have tested that my proposed changes behave as described — review/static-analysis only, not on-air.
  • On-hardware testing requested from community: build-verified t-deck-tft only.

Two sites built ClientNotification messages with sprintf into a
fixed-size proto buffer with no length cap. The current format strings
fit comfortably, but a future caller editing either format string
without rechecking the buffer size would get a silent stack/heap
overrun. Switch to snprintf with sizeof so the bound is enforced at
the call site.
@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels May 9, 2026
@thebentern thebentern merged commit 1bcabb8 into meshtastic:develop May 9, 2026
78 of 80 checks passed
balya pushed a commit to balya/meshtastic-firmware that referenced this pull request May 14, 2026
)

Two sites built ClientNotification messages with sprintf into a
fixed-size proto buffer with no length cap. The current format strings
fit comfortably, but a future caller editing either format string
without rechecking the buffer size would get a silent stack/heap
overrun. Switch to snprintf with sizeof so the bound is enforced at
the call site.

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants