Prevents the posibility of buffer overflow in mixer parsing.

The fix limits scanf from overwritting the geomname buffer local
variable. Thus preventing stack corruption as noted by chungkim.
This commit is contained in:
David Sidrane authored and Lorenz Meier committed 2016-10-12 22:58:55 +02:00
1 parent f30dd2b819
commit db44129ec0
1 file changed
+1 -1
@@ -132,7 +132,7 @@ MultirotorMixer::from_text(Mixer::ControlCallback control_cb, uintptr_t cb_handl
}
if (sscanf(buf, "R: %s %d %d %d %d%n", geomname, &s[0], &s[1], &s[2], &s[3], &used) != 5) {
if (sscanf(buf, "R: %7s %d %d %d %d%n", geomname, &s[0], &s[1], &s[2], &s[3], &used) != 5) {
debug("multirotor parse failed on '%s'", buf);
return nullptr;
}