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 <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-11-12 09:58:13 +01:00 committed by Wolfgang Bumiller
parent 790d11edf1
commit 515d6a81d8

View File

@ -660,7 +660,7 @@ fn trim_ascii_whitespace_start(data: &[u8]) -> &[u8] {
fn trim_ascii_whitespace_end(data: &[u8]) -> &[u8] { fn trim_ascii_whitespace_end(data: &[u8]) -> &[u8] {
match data.iter().rposition(|&c| !c.is_ascii_whitespace()) { match data.iter().rposition(|&c| !c.is_ascii_whitespace()) {
Some(to) => &data[..to], Some(to) => &data[..=to],
None => data, None => data,
} }
} }