Fixed out of bounds bug bug

This commit is contained in:
wrk 2023-06-28 10:41:23 +02:00
parent b4a6ae1cb0
commit ec4f44ee77

View File

@ -641,6 +641,7 @@ async fn recv<T: AsyncRead>(
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<T: AsyncRead>(
break;
}
lines.push(line.to_owned());
if line.len() != 0 {
lines.push(line.to_owned());
}
}
Ok(lines)
}