5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-03-07 00:58:32 +03:00

tape: avoid panic potential in MAM attribute decoder

We already saw that quite some tape libraries/loaders/... ain't
always _that_ standard conform, and even if it'd be guaranteed, it
just makes no sense to create a potential for panicking the whole
daemon due to some sub-features hiccup, rather go for actual error
handling...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-05-17 14:57:15 +02:00
parent a4ff2cdc54
commit a18a63c827

View File

@ -257,7 +257,7 @@ fn decode_mam_attributes(data: &[u8]) -> Result<Vec<MamAttribute>, Error> {
format!("{}", u64::from_be_bytes(data[0..8].try_into()?))
}
} else {
unreachable!();
bail!("unexpected MAM attribute length {}", info.1);
}
}
MamFormat::BINARY => hex::encode(&data),