@cryptotaxi247 / netdata-1 / commits / abff94715

buffer overflow detected by the compiler (#13120)

* buffer overflow detected by the compiler * also increase the buffer +1

Costa Tsaousis committed Jun 14, 2022 at 16:44 UTC abff947156ad1401a1b0e04a7ea0b421017c0310
1 file changed +2 -2
parser/parser.c
+2 -2
@@ -9,7 +9,7 @@ static inline int find_keyword(char *str, char *keyword, int max_size, int (*cus
9 while (unlikely(custom_isspace(*s))) s++;
10 keyword_start = s;
11
12 - while (likely(*s && !custom_isspace(*s)) && max_size > 0) {
12 + while (likely(*s && !custom_isspace(*s)) && max_size > 1) {
13 *keyword++ = *s++;
14 max_size--;
15 }
@@ -238,7 +238,7 @@ inline int parser_action(PARSER *parser, char *input)
238 {
239 PARSER_RC rc = PARSER_RC_OK;
240 char *words[PLUGINSD_MAX_WORDS] = { NULL };
241 - char command[PLUGINSD_LINE_MAX];
241 + char command[PLUGINSD_LINE_MAX + 1];
242 keyword_function action_function;
243 keyword_function *action_function_list = NULL;
244