Skip to content

fix(telemetry): HoTT out-of-bounds warning byte and null sensor lookup - #7777

Merged
pfeerick merged 1 commit into
mainfrom
3djc/harden-hott
Sep 20, 2026
Merged

pfeerick merged 1 commit into
mainfrom
3djc/harden-hott

Conversation

@3djc

@3djc 3djc commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Review triggered by comments from @bsongis :)

True issue:
processHoTTWarnings() reads packet[14] (the device warnings byte) for every page 1-4 frame, but the MultiProtocol dispatcher only validated len >= 14, so with a 14-byte frame the warning code came from stale telemetryRxBuffer content and could raise a spurious HoTT warning. The frame is documented as [0]..[14]; the guard predates the warnings byte.

Possible issue if miss edit happens on HOTT data tables
getHottSensor() returned nullptr on a miss while ~60 call sites in processHottPacket() dereference the result unguarded. Return the table's sentinel entry instead so an unknown ID degrades to UNIT_RAW/precision 0; hottSetDefault() now tests sensor->name to detect a real match.

@3djc 3djc added bug 🪲 Something isn't working telemetry 📶 backport/2.12 To be backported to a 2.12 release also. labels Sep 9, 2026
@3djc

3djc commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

@mha1 , you introduced a lot of HoTT changes, I don't have any HoTT to test, would you mind testing this a bit ?

@mha1 mha1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this based on occurring issues? I don't think anyone would experience any issues with current firmware:

  • the MPM with firmware even years old sends a fixed 15 Byte packet for HoTT telemetry. The check for >= 14 never fails. HoTT telemetry with MPM firmware prior to the warning byte addition will stop working after updating the check against 15.
  • If HoTT telemetry is active there's never the case of no HoTT device, i.e. there's never a nullptr returned. The RX is always present. It is a HoTT telemetry device itself, is listed in hott_sensors and is the one carrying the warning byte. The RX will always be found or there's no telemetry at all. And as long as telemetry is up and running there's no stale warning.

Anhyhow, the nullptr change looks correct (and better), but solving a problem that I think doesn't exist.

The change to checking for >= 15 bytes is up to you. You're just cutting ties with ancient pre-warning MPM firmware.

I tested the changes with a GR-16, HoTT Vario, 4s voltage Module (acts as GAM) and MPM firmware that is sending the warning byte (15 byte packets):

  • sensor discover works
  • telemetry works
  • HoTT Lua works

getHottSensor() returned nullptr on a miss while ~60 call sites in
processHottPacket() dereference the result unguarded, so adding a
HOTT_ID_* without a matching hottSensors[] row would fault on the first
packet carrying it. Return the table's sentinel entry instead, degrading
an unknown ID to UNIT_RAW/precision 0; hottSetDefault() now tests
sensor->name to detect a real match.

No functional change for known sensor IDs; all 52 currently in use are
present in the table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L46atgcdiuY6x89RFh2nCW
@3djc

3djc commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

I agree with the 15 limit, but the nul ptr stays a risk, even if I agree with you that it currently doesn't materialize

@mha1

mha1 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

I agree with the 15 limit, but the nul ptr stays a risk, even if I agree with you that it currently doesn't materialize

No objection

@pfeerick pfeerick added this to the 2.12.5 milestone Sep 11, 2026
@3djc 3djc added house keeping 🧹 Cleanup of code and house keeping and removed bug 🪲 Something isn't working labels Sep 11, 2026
@pfeerick
pfeerick merged commit e794518 into main Sep 20, 2026
46 checks passed
@pfeerick
pfeerick deleted the 3djc/harden-hott branch September 20, 2026 02:45
@pfeerick pfeerick mentioned this pull request Sep 24, 2026
47 of 49 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/2.12 To be backported to a 2.12 release also. house keeping 🧹 Cleanup of code and house keeping telemetry 📶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants