Skip to content

Commit

Permalink
fix fatal when writing a chunk where size > internal buff size
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidaty committed Jan 28, 2023
1 parent 0da3055 commit e34dbfa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jsonwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ static inline size_t jsonwriter_output_buff_write(struct jsonwriter_output_buff
if(n) {
if(n + b->used > JSONWRITER_OUTPUT_BUFF_SIZE) {
jsonwriter_output_buff_flush(b);
if(n > JSONWRITER_OUTPUT_BUFF_SIZE) // n too big, so write directly
if(n > JSONWRITER_OUTPUT_BUFF_SIZE) { // n too big, so write directly
b->write(s, n, 1, b->write_arg);
return n;
}
}
// n + used < buff size
memcpy(b->buff + b->used, s, n);
Expand Down

0 comments on commit e34dbfa

Please sign in to comment.