This is an automated email from the ASF dual-hosted git repository. cederom pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 9b6b7607f20d2ce119d14ee56da084e1ff582ac7 Author: Tiago Medicci <[email protected]> AuthorDate: Mon Apr 20 17:26:17 2026 -0300 system/irtest: Avoids silently truncating long write_data commands Long write_data commands can be truncated without any check due to the maximum size of CONFIG_SYSTEM_IRTEST_MAX_SIRDATA. This commit adds a check to avoid a silent fail. Signed-off-by: Tiago Medicci <[email protected]> --- system/irtest/cmd.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/system/irtest/cmd.cxx b/system/irtest/cmd.cxx index 8dde00437..c8673c9b1 100644 --- a/system/irtest/cmd.cxx +++ b/system/irtest/cmd.cxx @@ -31,6 +31,7 @@ #include <pthread.h> #include <stdio.h> #include <fcntl.h> +#include <errno.h> #include <unistd.h> #include "enum.hpp" @@ -246,6 +247,17 @@ CMD1(write_data, size_t, index) data[size] = tmp; } + /* Avoid silently truncating long write_data commands. */ + + if (size == CONFIG_SYSTEM_IRTEST_MAX_SIRDATA) + { + tmp = get_next_arg < uint32_t > (); + if (tmp != 0) + { + return -E2BIG; + } + } + /* lirc require the odd length */ if (size % 2 == 0)
