fixed #139 - handle incorrect terminal modes list length

This commit is contained in:
Eugene Pankov 2022-06-22 21:26:02 +02:00
parent eb3c13d62b
commit 7b0bdbcce8
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4

View file

@ -88,7 +88,11 @@ impl russh::server::Handler for ServerHandler {
session: Session,
) -> Self::FutureUnit {
let term = term.to_string();
let modes = modes.to_vec();
let modes = modes
.into_iter()
.take_while(|x| (x.0 as u8) > 0 && (x.0 as u8) < 160)
.map(Clone::clone)
.collect();
async move {
{
let mut this_session = self.session.lock().await;