diff --git a/libraries/SITL/SIM_Frame.cpp b/libraries/SITL/SIM_Frame.cpp index 639b6deecd..32bc4a7992 100644 --- a/libraries/SITL/SIM_Frame.cpp +++ b/libraries/SITL/SIM_Frame.cpp @@ -345,7 +345,8 @@ void Frame::load_frame_params(const char *model_json) if (fd == -1) { AP_HAL::panic("%s failed to load\n", model_json); } - char buf[st.st_size]; + char buf[st.st_size+1]; + memset(buf, '\0', sizeof(buf)); if (AP::FS().read(fd, buf, st.st_size) != st.st_size) { AP_HAL::panic("%s failed to load\n", model_json); }