s390-tools/s390-tools-pvimg-info-command-01.patch
Nikolay Gueorguiev d7162287c1 - Upgrade s390-tools to 2.37 (jsc#PED-9591, jsc#PED-10303, jesc#PED-11870 (jsc#IBM-1062))
* Changes of existing tools:
    dbginfo.sh: Add details on CPU-measurement
    dbginfo.sh: Add new crypto command
    dbginfo.sh: Add overview commands and crypto update
    dbginfo.sh: Adding kdump info
    dbginfo.sh: Removing outdated email references
    dbginfo.sh: Rework network section
    dbginfo.sh: Update copyright 2nd year
    pvimg: Add '--(enable|disable)-image-encryption' flags to 'pvimg create'
    pvimg: Add '--cck ' command line option and make '--comm-key' an alias
    pvimg: Add '--hdr-key' command line option to 'pvimg create'
    pvimg: Rename '--key' into '--hdr-key' and use '--key' as an alias (for 'pvimg info')
    pvsecret: Add support for retrievable secrets
    ziorep_config: Add PCHID field to adapter report
    ziorep_traffic: Add DEVBUSID column to traffic report
    ziorep_utilization: Add --fcp-device parameter to print virtual adapter report
    ziorep_utilization: Add PCHID column to physical adapter report
    ziorep_utilization: Now prints only physical adapter report by default
    ziorep_utilization: Swap Bus-ID and CHPID columns in virtual adapter report
    zipl/boot: Increase section size for eckd_mv dumper
    zkey: Add support for listing and importing protected virtualization secrets
  * Bug Fixes:
    chpstat: Fix invalid utilization data on older kernels
    opticsmon: Fix runaway loop in on_link_change()
    zipl: Update inline assembly for GCC 15
    zipl_helper.device-mapper: Add missed step in logical device resolution
- Revendored vendor.tar.gz
- Removed obsolete patches:
  * s390-tools-01-zipl_helper.device-mapper-add-missed-step-in-logical.patch
  * s390-tools-02-zipl-src-fix-imprecise-check-that-file-is-on-specifi.patch
  * s390-tools-General-update-01.patch
  * s390-tools-General-update-02.patch
  * s390-tools-General-update-03.patch
  * s390-tools-General-update-04.patch
  * s390-tools-General-update-05.patch
  * s390-tools-General-update-06.patch
  * s390-tools-General-update-07.patch
  * s390-tools-General-update-08.patch
  * s390-tools-General-update-09.patch
  * s390-tools-General-update-10.patch
  * s390-tools-General-update-11.patch
  * s390-tools-General-update-12.patch
  * s390-tools-Additional-update-01.patch
  * s390-tools-Additional-update-02.patch
  * s390-tools-pvimg-info-command-01.patch
  * s390-tools-pvimg-info-command-02.patch
  * s390-tools-pvimg-info-command-03.patch
  * s390-tools-Support-unencrypted-SE-images-01.patch
  * s390-tools-pvimg-info-command-04.patch
  * s390-tools-pvimg-additional-01.patch
  * s390-tools-01-zkey-Add-support-for-retrieving-a-list-of-ultravisor-secrets.patch
  * s390-tools-02-zkey-Add-the--pvsecrets-list-command.patch
  * s390-tools-03-zkey-Add-PVSECRETS-AES-key-type.patch
  * s390-tools-04-zkey-Add-the-pvsecrets-import-command.patch
  * s390-tools-05-zkey-Reject-key-generation-and-APQN-association-for-PVSECRET-AES-keys.patch
  * s390-tools-06-zkey-Reject-re-enciphering-of-PVSECRET-AES-keys.patch
  * s390-tools-07-zkey-Support-validation-of-key-of-type-PVSECRET-AES.patch
  * s390-tools-08-rust-pvimg-Fix-flag-parsing-for-allowing-dump.patch
  * s390-tools-09-rust-pvimg-Document-the-change-from--comm-key-to--cck.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=249
2025-02-10 08:51:00 +00:00

59 lines
1.8 KiB
Diff

From 560b276f7e9938475af921c8ebd4cd05910dbf31 Mon Sep 17 00:00:00 2001
From: Marc Hartmayer <mhartmay@linux.ibm.com>
Date: Fri, 6 Dec 2024 20:45:36 +0100
Subject: [PATCH] rust/pvimg: Fix possible 'range start index out of range for
slice' error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix possible 'range start index 16 out of range for slice of length 0'
error by adding a check of the slice data length.
Fixes: f4cf4ae6ebb1 ("rust: Add a new tool called 'pvimg'")
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
---
rust/pvimg/src/pv_utils/se_hdr/brb.rs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/rust/pvimg/src/pv_utils/se_hdr/brb.rs b/rust/pvimg/src/pv_utils/se_hdr/brb.rs
index f7ae1bc9..ac3a2e6e 100644
--- a/rust/pvimg/src/pv_utils/se_hdr/brb.rs
+++ b/rust/pvimg/src/pv_utils/se_hdr/brb.rs
@@ -259,6 +259,10 @@ impl SeHdr {
return Err(Error::InvalidSeHdr);
}
+ if sehs <= common_size {
+ return Err(Error::InvalidSeHdr);
+ }
+
data.resize(sehs, 0);
reader.read_exact(&mut data[common_size..])?;
Self::try_from_data(&data)
@@ -366,3 +370,22 @@ impl AeadCipherTrait for SeHdrPlain {
self.data.aead_tag_size()
}
}
+
+#[cfg(test)]
+mod tests {
+ use std::io::Cursor;
+
+ use super::SeHdr;
+ use crate::error::Error;
+
+ #[test]
+ fn test_sehdr_try_from_io() {
+ // Invalid SeHdr as `sehs` is set to 0
+ assert!(matches!(
+ SeHdr::try_from_io(Cursor::new([
+ 73, 66, 77, 83, 101, 99, 69, 120, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 8
+ ])),
+ Err(Error::InvalidSeHdr)
+ ));
+ }
+}