From f850c76a1b1f92a00862cd0b7dc0f949778e5d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Sat, 7 Oct 2017 16:25:53 +0200 Subject: [PATCH] Dont panic on unknown file attributes. --- src/dir.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dir.rs b/src/dir.rs index 9af8966..cde09b5 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -294,8 +294,8 @@ pub struct DirIter<'a, 'b: 'a> { impl <'a, 'b> DirIter<'a, 'b> { fn read_dir_entry_data(&mut self) -> io::Result { let mut name = [0; 11]; - self.rdr.read(&mut name)?; - let attrs = FileAttributes::from_bits(self.rdr.read_u8()?).expect("invalid attributes"); // FIXME + self.rdr.read_exact(&mut name)?; + let attrs = FileAttributes::from_bits_truncate(self.rdr.read_u8()?); if attrs == FileAttributes::LFN { let mut data = DirLfnEntryData { attrs, ..Default::default()