Skip to content

Guard short BLE parser payloads - #1591

Open
IoannisArmamentos wants to merge 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/parser-length-validation
Open

Guard short BLE parser payloads#1591
IoannisArmamentos wants to merge 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/parser-length-validation

Conversation

@IoannisArmamentos

Copy link
Copy Markdown
Contributor

Summary

Add missing payload-length validation to several BLE parsers.

Problem

The Sensirion, Almendo, and RuuviTag parsers could receive truncated manufacturer data that passed the shared dispatcher but was still too short for direct indexing or struct.unpack() calls.

Depending on the parser and payload length, this could result in exceptions such as:

  • IndexError
  • ValueError
  • struct.error

Fix

Add parser specific length validation before accessing fields that require a minimum payload size.

The checks are kept format-specific where necessary, especially for RuuviTag V3 and V5 payloads, so valid shorter formats are not rejected.

Regression tests cover truncated advertisements while preserving existing valid parsing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant