Browse Source

MIXERIOCLOADBUF ioctl: remove unnecessary string length restriction

mixer.cpp ensures the string is null-terminated (buffer length is 2048).
sbg
Beat Küng 5 years ago
parent
commit
529da7b33e
  1. 2
      src/drivers/dshot/dshot.cpp
  2. 2
      src/drivers/mkblctrl/mkblctrl.cpp
  3. 2
      src/drivers/pwm_out_sim/PWMSim.cpp
  4. 2
      src/drivers/px4fmu/fmu.cpp
  5. 2
      src/drivers/px4io/px4io.cpp
  6. 2
      src/drivers/uavcan/uavcan_main.cpp

2
src/drivers/dshot/dshot.cpp

@ -1070,7 +1070,7 @@ DShotOutput::pwm_ioctl(file *filp, int cmd, unsigned long arg) @@ -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;

2
src/drivers/mkblctrl/mkblctrl.cpp

@ -1052,7 +1052,7 @@ MK::pwm_ioctl(file *filp, int cmd, unsigned long arg) @@ -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);

2
src/drivers/pwm_out_sim/PWMSim.cpp

@ -219,7 +219,7 @@ PWMSim::ioctl(device::file_t *filp, int cmd, unsigned long arg) @@ -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;
}

2
src/drivers/px4fmu/fmu.cpp

@ -1470,7 +1470,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg) @@ -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();

2
src/drivers/px4io/px4io.cpp

@ -2704,7 +2704,7 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg) @@ -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;
}

2
src/drivers/uavcan/uavcan_main.cpp

@ -1099,7 +1099,7 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg) @@ -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);

Loading…
Cancel
Save