From b33f65fd448323b5f204ad08c48d8e259910ff7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 20 Dec 2020 14:35:35 +0100 Subject: [PATCH] Fix the line buffer that was flooded with extra \0 --- src/io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io.rs b/src/io.rs index f1cd3c1..a357d4e 100644 --- a/src/io.rs +++ b/src/io.rs @@ -28,7 +28,7 @@ fn do_read_stdin(tx: &Sender>) -> Result<(), String> { if len == 0 { return Err(String::from("unable to read on stdin")); } - line_buffer.extend_from_slice(&read_buffer); + line_buffer.extend_from_slice(&read_buffer[..len]); loop { match line_buffer.iter().position(|i| *i == b'\n') { Some(id) => {