From 710d88cf3c61eafe5d2458209b8c0fd16a567bb3 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 20 Oct 2009 01:38:38 +0300 Subject: [PATCH] Ticket #1725: Do not abort on broken .cpio file For some reason, mc aborts if .cpio magic as wrong. This trivial patch makes mc handle it gracefully. Signed-off-by: Slava Zanko --- vfs/cpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vfs/cpio.c b/vfs/cpio.c index f9fa1a820..5eeef9551 100644 --- a/vfs/cpio.c +++ b/vfs/cpio.c @@ -290,9 +290,9 @@ static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *supe for(i = 0; i < (HEAD_LENGTH >> 1); i++) u.shorts[i] = GUINT16_SWAP_LE_BE_CONSTANT(u.shorts[i]); } - g_assert(u.buf.c_magic == 070707); - if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) { + if (u.buf.c_magic != 070707 || + u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) { message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"), super->name); return STATUS_FAIL;