public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming
@ 2021-11-12  8:58 Dominik Csapak
  2021-11-12  8:58 ` [pve-devel] [PATCH proxmox-perl-rs 2/2] pve-rs/tfa: ignore and discard incomplete u2f entries Dominik Csapak
  2021-11-12  9:23 ` [pve-devel] applied-series: [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming Wolfgang Bumiller
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-11-12  8:58 UTC (permalink / raw)
  To: pve-devel

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>
---
 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-12  9:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12  8:58 [pve-devel] [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming Dominik Csapak
2021-11-12  8:58 ` [pve-devel] [PATCH proxmox-perl-rs 2/2] pve-rs/tfa: ignore and discard incomplete u2f entries Dominik Csapak
2021-11-12  9:23 ` [pve-devel] applied-series: [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal