src/pxar/sequential_decoder.rs: Cleanup and fix incorrect error message

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-07-01 17:03:49 +02:00 committed by Dietmar Maurer
parent 80af046794
commit 9d227350a3

View File

@ -123,8 +123,8 @@ impl <'a, R: Read> SequentialDecoder<'a, R> {
bail!("filename entry not nul terminated."); bail!("filename entry not nul terminated.");
} }
if (buffer.len() == 1 && buffer[0] == b'.') || (buffer.len() == 2 && buffer[0] == b'.' && buffer[1] == b'.') { if buffer == b"." || buffer == b".." {
bail!("found invalid filename with slashes."); bail!("found invalid filename '.' or '..'.");
} }
if buffer.iter().find(|b| (**b == b'/')).is_some() { if buffer.iter().find(|b| (**b == b'/')).is_some() {