fix(hci/gap): bound extended adv EIR to Data_Length and harden malformed service-data parsing#69
Open
peterneutron wants to merge 1 commit intostoprocent:mainfrom
Open
fix(hci/gap): bound extended adv EIR to Data_Length and harden malformed service-data parsing#69peterneutron wants to merge 1 commit intostoprocent:mainfrom
peterneutron wants to merge 1 commit intostoprocent:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #64
This fixes an extended advertising parsing issue where the current report's EIR payload was not bounded to its declared
Data_Length. When multiple extended advertising reports are included in a single HCI event, bytes from the next report could be passed intogap.jsas if they belonged to the current report.It also hardens
gap.jsservice-data parsing so malformed/truncated service-data AD fields do not crash parsing.What changed
lib/hci-socket/hci.jseirLengthdata.slice(24)data.slice(24, 24 + eirLength)data.length < 24)data.length < 24 + eirLength)this.emit('leExtendedAdvertisingReport', ...)outside the parsertry/catchlib/hci-socket/gap.js0x16,0x20,0x21) so UUID parsing only runs when the payload is at least the required UUID lengthWhy this is safe
Data_Length; bounding the EIR slice to that length matches the report framingUUID-onlyservice-data fields (empty service payload) still workValidation
null.reverse()failure after applying the fix