From b3ce3cbaff63a1ba7b623407d82fc96bd47bd24c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 1 Jan 2017 18:35:13 +0100 Subject: [PATCH] Simple mixer: Remove incorrect pre-parser and replace with fixed central implementation --- src/modules/systemlib/mixer/mixer_simple.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/systemlib/mixer/mixer_simple.cpp b/src/modules/systemlib/mixer/mixer_simple.cpp index f8d18fb2e1..1f25633028 100644 --- a/src/modules/systemlib/mixer/mixer_simple.cpp +++ b/src/modules/systemlib/mixer/mixer_simple.cpp @@ -161,6 +161,11 @@ SimpleMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handle, c int used; const char *end = buf + buflen; + /* enforce that the mixer ends with a new line */ + if (!string_well_formed(buf, buflen)) { + return nullptr; + } + /* get the base info for the mixer */ if (sscanf(buf, "M: %u%n", &inputs, &used) != 1) { debug("simple parse failed on '%s'", buf);