diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-06-14 16:44:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 16:44:07 +0300 |
commit | abff947156ad1401a1b0e04a7ea0b421017c0310 (patch) | |
tree | 024c3dc4706c877c5cf56d81fca829910872c5ba /parser | |
parent | f383e57646fed8432157b035dc775f297c398114 (diff) |
buffer overflow detected by the compiler (#13120)
* buffer overflow detected by the compiler
* also increase the buffer +1
Diffstat (limited to 'parser')
-rw-r--r-- | parser/parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parser/parser.c b/parser/parser.c index 01256da4a6..c37d1e2c43 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -9,7 +9,7 @@ static inline int find_keyword(char *str, char *keyword, int max_size, int (*cus while (unlikely(custom_isspace(*s))) s++; keyword_start = s; - while (likely(*s && !custom_isspace(*s)) && max_size > 0) { + while (likely(*s && !custom_isspace(*s)) && max_size > 1) { *keyword++ = *s++; max_size--; } @@ -238,7 +238,7 @@ inline int parser_action(PARSER *parser, char *input) { PARSER_RC rc = PARSER_RC_OK; char *words[PLUGINSD_MAX_WORDS] = { NULL }; - char command[PLUGINSD_LINE_MAX]; + char command[PLUGINSD_LINE_MAX + 1]; keyword_function action_function; keyword_function *action_function_list = NULL; |