Skip to content

Commit

Permalink
sds: fix off by 1 bug in flb_sds_printf
Browse files Browse the repository at this point in the history
Note: this is a port of Wesleys fix in fluent-bit

Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Apr 25, 2023
1 parent 82839c4 commit fde4d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cfl_sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ cfl_sds_t cfl_sds_printf(cfl_sds_t *sds, const char *fmt, ...)
}
va_end(ap);

if (size > cfl_sds_avail(s)) {
tmp = cfl_sds_increase(s, size);
if (size >= cfl_sds_avail(s)) {
tmp = cfl_sds_increase(s, size - flb_sds_avail(s) + 1);
if (!tmp) {
return NULL;
}
Expand Down

0 comments on commit fde4d8a

Please sign in to comment.