AP_ADSB: correct copying of callsign in Sagetech XP ADSB driver#32655
Merged
Conversation
IamPete1
reviewed
Apr 13, 2026
| if (msg.payload[16] != 0) { | ||
| // if string is non-null, consider it valid | ||
| memcpy(&vehicle.info, &msg.payload[16], 8); | ||
| memcpy(&vehicle.info.callsign, &msg.payload[16], ARRAY_SIZE(vehicle.info.callsign)-1); // "The callsign, 8+null" means we subtract one here |
Member
There was a problem hiding this comment.
I know that currently ARRAY_SIZE(vehicle.info.callsign)-1) is 8. But that could change, I guess its 8 bytes in the message payload. Should this be MIN(8, ARRAY_SIZE(vehicle.info.callsign)-1)?
Contributor
Author
There was a problem hiding this comment.
I know that currently
ARRAY_SIZE(vehicle.info.callsign)-1)is 8. But that could change, I guess its 8 bytes in the message payload. Should this beMIN(8, ARRAY_SIZE(vehicle.info.callsign)-1)?
Yeah. I considered it. Thought it might be going a bit far given the one to worry about would be the wire format!
I've added the patch, thanks!
c2e9da9 to
a3a8181
Compare
IamPete1
approved these changes
Apr 13, 2026
rmackay9
reviewed
Apr 14, 2026
| if (msg.payload[16] != 0) { | ||
| // if string is non-null, consider it valid | ||
| memcpy(&vehicle.info, &msg.payload[16], 8); | ||
| memcpy(&vehicle.info.callsign, &msg.payload[16], MIN(ARRAY_SIZE(vehicle.info.callsign)-1, 8)); // "The callsign, 8+null" means we subtract one here |
Contributor
There was a problem hiding this comment.
maybe move the comment to the line above?
a3a8181 to
01f3318
Compare
tridge
approved these changes
Apr 14, 2026
this appeared to be overwriting all of the data at the start of the mavlink packet, rather than overwriting the callsign within the packet.
01f3318 to
d5bc6bd
Compare
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
this appeared to be overwriting all of the data at the start of the mavlink packet, rather than overwriting the callsign within the packet.
Testing (more checks increases chance of being merged)
Description
This appears to have been DOA.
This issue was responsibly disclosed to the ArduPilot development team by secmate.dev.