Land detector: Harden string handling

Due to known input this was not a real issue, but bad style.
This commit is contained in:
Lorenz Meier
2017-01-03 14:44:45 +01:00
committed by Beat Küng
parent 1a1522d3ff
commit 66226fb754
@@ -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;
}