Skip to content

Commit 4398afe

Browse files
committed
Update encode.rs
1 parent db1c1d7 commit 4398afe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/server/encode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ impl Encoder {
257257
// Calculate the max char count encoding the `len_prefix` statement
258258
// as hex would take. This is done by rounding up `log16(amt)`.
259259
let hex_len = (amt as f64).log(16.0).ceil() as usize;
260-
let buf_upper = buf_len.checked_sub(hex_len + 4).unwrap_or(0);
260+
let crlf_len = 2 * 2;
261+
let buf_upper = buf_len.checked_sub(hex_len + crlf_len).unwrap_or(0);
261262
let amt = amt.min(buf_upper);
262263
let len_prefix = format!("{:X}", amt).into_bytes();
263264

0 commit comments

Comments
 (0)