From ec4f44ee77542984f7da6f686bd09e46de042744 Mon Sep 17 00:00:00 2001 From: wrk Date: Wed, 28 Jun 2023 10:41:23 +0200 Subject: [PATCH] Fixed out of bounds bug bug --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index fc49f2a..b76d24a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -641,6 +641,7 @@ async fn recv( for (index, line) in new_lines.into_iter().enumerate() { if buf.len() < 2 { + println!("shit {:?}", buf); continue; } if index == len - 1 && &buf[buf.len() - 2..] != b"\r\n" { @@ -648,7 +649,9 @@ async fn recv( break; } - lines.push(line.to_owned()); + if line.len() != 0 { + lines.push(line.to_owned()); + } } Ok(lines) }