mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-05 11:18:54 +08:00
Land detector: Harden string handling
Due to known input this was not a real issue, but bad style.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user