GCS_MAVLink: prevent uninitialised bytes being written to a serial port

This commit is contained in:
Andrew Tridgell 2014-04-25 08:14:26 +10:00
parent 0306dbf5f1
commit cf9b67d8fc
1 changed files with 1 additions and 0 deletions

View File

@ -611,6 +611,7 @@ GCS_MAVLINK::send_text_P(gcs_severity severity, const prog_char_t *str)
{ {
mavlink_statustext_t m; mavlink_statustext_t m;
uint8_t i; uint8_t i;
memset(m.text, 0, sizeof(m.text));
for (i=0; i<sizeof(m.text); i++) { for (i=0; i<sizeof(m.text); i++) {
m.text[i] = pgm_read_byte((const prog_char *)(str++)); m.text[i] = pgm_read_byte((const prog_char *)(str++));
if (m.text[i] == '\0') { if (m.text[i] == '\0') {