Skip to content

Commit e34dbfa

Browse files
committed
fix fatal when writing a chunk where size > internal buff size
1 parent 0da3055 commit e34dbfa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jsonwriter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ static inline size_t jsonwriter_output_buff_write(struct jsonwriter_output_buff
5252
if(n) {
5353
if(n + b->used > JSONWRITER_OUTPUT_BUFF_SIZE) {
5454
jsonwriter_output_buff_flush(b);
55-
if(n > JSONWRITER_OUTPUT_BUFF_SIZE) // n too big, so write directly
55+
if(n > JSONWRITER_OUTPUT_BUFF_SIZE) { // n too big, so write directly
5656
b->write(s, n, 1, b->write_arg);
57+
return n;
58+
}
5759
}
5860
// n + used < buff size
5961
memcpy(b->buff + b->used, s, n);

0 commit comments

Comments
 (0)