mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 21:55:34 +08:00
MIXERIOCLOADBUF ioctl: remove unnecessary string length restriction
mixer.cpp ensures the string is null-terminated (buffer length is 2048).
This commit is contained in:
@@ -1070,7 +1070,7 @@ DShotOutput::pwm_ioctl(file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strnlen(buf, 1024);
|
||||
unsigned buflen = strlen(buf);
|
||||
ret = _mixing_output.loadMixerThreadSafe(buf, buflen);
|
||||
|
||||
break;
|
||||
|
||||
@@ -1052,7 +1052,7 @@ MK::pwm_ioctl(file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strnlen(buf, 1024);
|
||||
unsigned buflen = strlen(buf);
|
||||
|
||||
if (_mixers == nullptr) {
|
||||
_mixers = new MixerGroup(control_callback, (uintptr_t)&_controls);
|
||||
|
||||
@@ -219,7 +219,7 @@ PWMSim::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strnlen(buf, 1024);
|
||||
unsigned buflen = strlen(buf);
|
||||
ret = _mixing_output.loadMixerThreadSafe(buf, buflen);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1470,7 +1470,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strnlen(buf, 1024);
|
||||
unsigned buflen = strlen(buf);
|
||||
ret = _mixing_output.loadMixerThreadSafe(buf, buflen);
|
||||
update_pwm_trims();
|
||||
|
||||
|
||||
@@ -2704,7 +2704,7 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
ret = mixer_send(buf, strnlen(buf, 2048));
|
||||
ret = mixer_send(buf, strlen(buf));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1099,7 +1099,7 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strnlen(buf, 1024);
|
||||
unsigned buflen = strlen(buf);
|
||||
|
||||
if (_mixers == nullptr) {
|
||||
_mixers = new MixerGroup(control_callback, (uintptr_t)_controls);
|
||||
|
||||
Reference in New Issue
Block a user