diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-22 11:16:19 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-22 11:16:19 +0200 |
commit | f62aeba4207beaeeff63af970ec5d6bb2fb1e8a7 (patch) | |
tree | 5ab79591d24d1d2e1565a0c989a5b99217e908ed /src/modules/systemlib/mixer/mixer_multirotor.cpp | |
parent | 669d4c6dd26cec44196f755b223da588439816c6 (diff) | |
download | px4-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.cpp | 7 |
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); |