AP_ADSB: Fix error snprintf output truncated

AP_ADSB: Change octal squawk code mask to 0x1FFF
This commit is contained in:
hoangthien94 2018-07-20 22:18:26 +08:00 committed by Francisco Ferreira
parent d6dca1f6a1
commit 0d964a5502
1 changed files with 1 additions and 1 deletions

View File

@ -640,7 +640,7 @@ uint8_t AP_ADSB::get_encoded_callsign_null_char()
// using the above logic, we must always assign the squawk. once we get configured
// externally then get_encoded_callsign_null_char() stops getting called
snprintf(out_state.cfg.callsign, 5, "%04d", unsigned(out_state.cfg.squawk_octal));
snprintf(out_state.cfg.callsign, 5, "%04d", unsigned(out_state.cfg.squawk_octal) & 0x1FFF);
memset(&out_state.cfg.callsign[4], 0, 5); // clear remaining 5 chars
encoded_null |= 0x40;