Skip to content

Commit 1d4e72e

Browse files
braydonkAndrewChubatiuk
authored andcommitted
pack: do not multiply out_size by realloc_size (#9193)
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
1 parent 8410c97 commit 1d4e72e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/flb_pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ flb_sds_t flb_msgpack_raw_to_json_sds(const void *in_buf, size_t in_size)
811811
tmp_buf = flb_sds_increase(out_buf, realloc_size);
812812
if (tmp_buf) {
813813
out_buf = tmp_buf;
814-
out_size *= realloc_size;
814+
out_size = flb_sds_alloc(out_buf);
815815
}
816816
else {
817817
flb_errno();

0 commit comments

Comments
 (0)