From 515d6a81d8ac3887a0a6ded465a83a5bae399eff Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 12 Nov 2021 09:58:13 +0100 Subject: [PATCH] pve-rs/tfa: fix off by one trimming to is the last *valid* character, and ranges end by default with one less, so extend the range to the actual last character this fixes an issue that we could not parse old configs with non-padded base64 values Signed-off-by: Dominik Csapak Signed-off-by: Wolfgang Bumiller --- pve-rs/src/tfa/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pve-rs/src/tfa/mod.rs b/pve-rs/src/tfa/mod.rs index df192b4..44cec74 100644 --- a/pve-rs/src/tfa/mod.rs +++ b/pve-rs/src/tfa/mod.rs @@ -660,7 +660,7 @@ fn trim_ascii_whitespace_start(data: &[u8]) -> &[u8] { fn trim_ascii_whitespace_end(data: &[u8]) -> &[u8] { match data.iter().rposition(|&c| !c.is_ascii_whitespace()) { - Some(to) => &data[..to], + Some(to) => &data[..=to], None => data, } }