Repository navigation
GPS guard: reject positions outside +-90/+-180 degrees - #3820
Open
nullrouten0 wants to merge 1 commit into
Open
nullrouten0 wants to merge 1 commit into
nullrouten0 wants to merge 1 commit into
Conversation
A garbled sentence can pass its checksum and parse to an impossible
position (e.g. 100.67, 181.65). The guard now rejects it ("rej coord").
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What changes
gps guardgets one more check: latitude must be within ±90° and longitude within ±180°. Otherwise the fix is rejected andgps guardshowsrej coord. 3 lines inGpsGuard.h, one doc line, and a small test.Why
A garbled sentence can still pass its checksum and parse to an impossible position. Example: latitude
9999.9999, longitude18099.0000gives 100.67°, 181.65°. On currentdevwithGPS_GUARDon, the guard accepts this asok 8satand it becomes the node's last fix (position, adverts, telemetry). With this change it showsrej coordand no position is stored.Found in a security review of the GPS code. Low severity: no crash, just a wrong position. You asked in #3626 to fit this into
gps guard, so this replaces it.What I checked
dev,GPS_GUARDon, the sentence above: beforeok 8sat, afterrej coord, position not stored. A normal position still getsok.Heltec_t114_repeaterwith-DGPS_GUARD: builds, and the guard code is in the firmware.Not checked
GPS_GUARDstill accept an impossible position, because the guard is not there. I followed your request and left them alone. A one-line check inisValid()would cover them if you want it.RTClib.hmock soGpsGuard.hcompiles in the native tests. No hardware test.🤖 Generated with Claude Code