aboutsummaryrefslogtreecommitdiff
path: root/src/modules/systemlib/mixer/mixer_multirotor.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-09-22 11:16:19 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-09-22 11:16:19 +0200
commitf62aeba4207beaeeff63af970ec5d6bb2fb1e8a7 (patch)
tree5ab79591d24d1d2e1565a0c989a5b99217e908ed /src/modules/systemlib/mixer/mixer_multirotor.cpp
parent669d4c6dd26cec44196f755b223da588439816c6 (diff)
downloadpx4-firmware-f62aeba4207beaeeff63af970ec5d6bb2fb1e8a7.tar.gz
px4-firmware-f62aeba4207beaeeff63af970ec5d6bb2fb1e8a7.tar.bz2
px4-firmware-f62aeba4207beaeeff63af970ec5d6bb2fb1e8a7.zip
Cover last potential corner case with mixers, should be totally safe now
Diffstat (limited to 'src/modules/systemlib/mixer/mixer_multirotor.cpp')
-rw-r--r--src/modules/systemlib/mixer/mixer_multirotor.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/systemlib/mixer/mixer_multirotor.cpp b/src/modules/systemlib/mixer/mixer_multirotor.cpp
index 8ded0b05c..576af5e30 100644
--- a/src/modules/systemlib/mixer/mixer_multirotor.cpp
+++ b/src/modules/systemlib/mixer/mixer_multirotor.cpp
@@ -181,6 +181,13 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl
char geomname[8];
int s[4];
int used;
+ const char *end = buf + buflen;
+
+ /* require a space or newline at the end of the buffer */
+ if (*end != ' ' && *end != '\n' && *end != '\r') {
+ debug("multirotor parser rejected: No newline / space at end of buf.");
+ return nullptr;
+ }
if (sscanf(buf, "R: %s %d %d %d %d%n", geomname, &s[0], &s[1], &s[2], &s[3], &used) != 5) {
debug("multirotor parse failed on '%s'", buf);