all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-perl-rs 1/2] pve-rs/tfa: fix off by one trimming
Date: Fri, 12 Nov 2021 09:58:13 +0100	[thread overview]
Message-ID: <20211112085814.1643605-1-d.csapak@proxmox.com> (raw)

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





             reply	other threads:[~2021-11-12  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12  8:58 Dominik Csapak [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211112085814.1643605-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal