diff --git a/system/nxinit/Kconfig b/system/nxinit/Kconfig index 3cd256bf7..29aa691c8 100644 --- a/system/nxinit/Kconfig +++ b/system/nxinit/Kconfig @@ -40,6 +40,7 @@ config SYSTEM_NXINIT_RC_FILE_PATH config SYSTEM_NXINIT_RC_LINE_MAX int "Max line length of RC file" default 128 + range 64 4096 ---help--- Maximum line length of RC file. More details: https://android.googlesource.com/platform/system/core/+/master/init/README.md diff --git a/system/nxinit/parser.c b/system/nxinit/parser.c index 664876b5a..c05f28917 100644 --- a/system/nxinit/parser.c +++ b/system/nxinit/parser.c @@ -109,7 +109,7 @@ static int init_parse_config_buffer(FAR const struct parser_s *parser, for (; ; ) { - r = MIN(len - off, sizeof(tmp)); + r = MIN(len - off, sizeof(tmp) - n); memcpy(&tmp[n], &buf[off], r); if (r == 0) {