From 8a8ee3c51abc54d08462ee6ca107ecde14ef87c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Wed, 8 Nov 2017 20:03:21 +0100 Subject: [PATCH] Ignore volume ID and label if signature is not valid. --- src/fs.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fs.rs b/src/fs.rs index 156f988..c5fb0e0 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -121,6 +121,12 @@ impl BiosParameterBlock { rdr.read_exact(&mut bpb.volume_label)?; rdr.read_exact(&mut bpb.fs_type_label)?; } + if bpb.ext_sig != 0x29 { + // fields after ext_sig are not used - clean them + bpb.volume_id = 0; + bpb.volume_label = [0; 11]; + bpb.fs_type_label = [0; 8]; + } Ok(bpb) } }