From 0d964a55022b9d868630a07c36fa885aad19d46b Mon Sep 17 00:00:00 2001 From: hoangthien94 Date: Fri, 20 Jul 2018 22:18:26 +0800 Subject: [PATCH] AP_ADSB: Fix error snprintf output truncated AP_ADSB: Change octal squawk code mask to 0x1FFF --- libraries/AP_ADSB/AP_ADSB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_ADSB/AP_ADSB.cpp b/libraries/AP_ADSB/AP_ADSB.cpp index 518bb969b3..428a61ae34 100644 --- a/libraries/AP_ADSB/AP_ADSB.cpp +++ b/libraries/AP_ADSB/AP_ADSB.cpp @@ -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;