Skip to content

Commit 0ec1a7b

Browse files
DavidKorczynskinokute78
authored andcommitted
record_accessor: fix stackoverflow.
Signed-off-by: davkor <[email protected]>
1 parent 2766d32 commit 0ec1a7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/flb_record_accessor.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,20 @@ static flb_sds_t ra_translate_keymap(struct flb_ra_parser *rp, flb_sds_t buf,
455455
}
456456
else if (v->type == FLB_RA_INT) {
457457
len = snprintf(str, sizeof(str) - 1, "%" PRId64, v->val.i64);
458+
/* We need to check size is not above str length */
459+
if (len >= 32) {
460+
*found = FLB_FALSE;
461+
return buf;
462+
}
458463
tmp = flb_sds_cat(buf, str, len);
459464
}
460465
else if (v->type == FLB_RA_FLOAT) {
461466
len = snprintf(str, sizeof(str) - 1, "%f", v->val.f64);
467+
/* We need to check size is not above str length */
468+
if (len >= 32) {
469+
*found = FLB_FALSE;
470+
return buf;
471+
}
462472
tmp = flb_sds_cat(buf, str, len);
463473
}
464474
else if (v->type == FLB_RA_STRING) {

0 commit comments

Comments
 (0)