mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
rc_input: fix possible string truncation (-Werror=stringop-truncation)
This commit is contained in:
@@ -58,7 +58,7 @@ RCInput::RCInput(const char *device) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
strncpy(_device, device, sizeof(_device));
|
strncpy(_device, device, sizeof(_device) - 1);
|
||||||
_device[sizeof(_device) - 1] = '\0';
|
_device[sizeof(_device) - 1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user