[pve-devel] applied-series: [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Nov 12 10:23:33 CET 2021


applied both patches, thanks

On Fri, Nov 12, 2021 at 09:58:13AM +0100, Dominik Csapak wrote:
> 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 at proxmox.com>
> ---
>  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,
>      }
>  }
> -- 
> 2.30.2





More information about the pve-devel mailing list