Skip to content

Commit

Permalink
core: test: Put 32MB limits of line buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jul 20, 2023
1 parent 78d88f5 commit 767b605
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/config_format/flb_cf_fluentbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx,
struct flb_cf_section *current_section = NULL;
struct flb_cf_group *current_group = NULL;
struct cfl_variant *var;
unsigned long line_hard_limit;

line_hard_limit = 32 * 1024 * 1024; /* 32MiB */

FILE *f = NULL;

Expand Down Expand Up @@ -523,6 +526,11 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx,
else {
/* resize the line buffer */
bufsize *= 2;
if (bufsize > line_hard_limit) {
flb_error("reading line is exceeded to the limit size of %lu. Current size is: %zu",
line_hard_limit, bufsize);
goto error;
}
buf = flb_realloc(buf, bufsize);
if (!buf) {
flb_error("failed to resize line buffer to %zu", bufsize);
Expand Down

0 comments on commit 767b605

Please sign in to comment.