From f62aeba4207beaeeff63af970ec5d6bb2fb1e8a7 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 22 Sep 2013 11:16:19 +0200 Subject: Cover last potential corner case with mixers, should be totally safe now --- src/modules/systemlib/mixer/mixer_multirotor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/modules/systemlib/mixer/mixer_multirotor.cpp') 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); -- cgit v1.2.3