1
0
Fork 0

Fix MK-VIII GPWS crash caused by getStringValue

Change local variable storage to a string, to avoid a crash
in this code detected by ASan.
This commit is contained in:
James Turner 2022-01-24 22:26:18 +00:00
parent 7d3f511560
commit af0df69126

View file

@ -1129,10 +1129,8 @@ MK_VIII::IOHandler::update_inputs ()
mk_dinput(glideslope_inhibit) = mk_node(nav0_gs_distance)->getDoubleValue() < 0; mk_dinput(glideslope_inhibit) = mk_node(nav0_gs_distance)->getDoubleValue() < 0;
if (mk_dinput_feed(autopilot_engaged)) if (mk_dinput_feed(autopilot_engaged))
{ {
const char *mode; const auto mode = mk_node(autopilot_heading_lock)->getStringValue();
mk_dinput(autopilot_engaged) = !mode.empty();
mode = mk_node(autopilot_heading_lock)->getStringValue().c_str();
mk_dinput(autopilot_engaged) = mode && *mode;
} }
if (mk_ainput_feed(uncorrected_barometric_altitude)) if (mk_ainput_feed(uncorrected_barometric_altitude))