Skip to content

Commit e3e0bb0

Browse files
DavidKorczynskinokute78
authored andcommitted
record_accessor: limit length check only to floats.
Signed-off-by: davkor <[email protected]>
1 parent 0ec1a7b commit e3e0bb0

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/flb_record_accessor.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -455,21 +455,16 @@ 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-
}
463458
tmp = flb_sds_cat(buf, str, len);
464459
}
465460
else if (v->type == FLB_RA_FLOAT) {
466461
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;
462+
if (len >= sizeof(str)) {
463+
tmp = flb_sds_cat(buf, str, sizeof(str)-1);
464+
}
465+
else {
466+
tmp = flb_sds_cat(buf, str, len);
471467
}
472-
tmp = flb_sds_cat(buf, str, len);
473468
}
474469
else if (v->type == FLB_RA_STRING) {
475470
tmp = flb_sds_cat(buf, v->val.string, flb_sds_len(v->val.string));

0 commit comments

Comments
 (0)