From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] tape: mam: actually enforcing the length when writing attributes
Date: Thu, 23 May 2024 12:08:00 +0200 [thread overview]
Message-ID: <20240523100800.3969965-1-d.csapak@proxmox.com> (raw)
we have to check against the length of the attribute, not the u16
maximum value.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pbs-tape/src/sg_tape/mam.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pbs-tape/src/sg_tape/mam.rs b/pbs-tape/src/sg_tape/mam.rs
index 4e995d0b..dc5163a5 100644
--- a/pbs-tape/src/sg_tape/mam.rs
+++ b/pbs-tape/src/sg_tape/mam.rs
@@ -169,7 +169,7 @@ pub fn write_mam_attribute<F: AsRawFd>(
attr_data.extend(data);
if !data.is_empty() && data.len() < attribute.len as usize {
attr_data.resize(attr_data.len() - data.len() + attribute.len as usize, 0);
- } else if data.len() > u16::MAX as usize {
+ } else if data.len() > attribute.len as usize {
bail!("data to long");
}
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next reply other threads:[~2024-05-23 10:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 10:08 Dominik Csapak [this message]
2024-05-24 7:50 ` Thomas Lamprecht
2024-05-24 8:19 ` Dominik Csapak
2024-05-24 8:26 ` Thomas Lamprecht
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=20240523100800.3969965-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox