Browse Source

Land detector: Harden string handling

Due to known input this was not a real issue, but bad style.
sbg
Lorenz Meier 8 years ago committed by Beat Küng
parent
commit
66226fb754
  1. 5
      src/modules/land_detector/land_detector_main.cpp

5
src/modules/land_detector/land_detector_main.cpp

@ -159,8 +159,9 @@ static int land_detector_start(const char *mode) @@ -159,8 +159,9 @@ static int land_detector_start(const char *mode)
}
}
//Remember current active mode
strncpy(_currentMode, mode, 12);
// Remember current active mode
strncpy(_currentMode, mode, sizeof(_currentMode) - 1);
_currentMode[sizeof(_currentMode) - 1] = '\0';
return 0;
}

Loading…
Cancel
Save