Ticket #1725: fix_abort_on_cpio.patch

File fix_abort_on_cpio.patch, 642 bytes (added by andrew_b, 15 years ago)
  • vfs/cpio.c

    diff --git a/vfs/cpio.c b/vfs/cpio.c
    index f9fa1a8..5eeef95 100644
    a b static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *supe 
    290290        for(i = 0; i < (HEAD_LENGTH >> 1); i++) 
    291291            u.shorts[i] = GUINT16_SWAP_LE_BE_CONSTANT(u.shorts[i]); 
    292292    } 
    293     g_assert(u.buf.c_magic == 070707); 
    294293 
    295     if (u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) { 
     294    if (u.buf.c_magic != 070707 || 
     295        u.buf.c_namesize == 0 || u.buf.c_namesize > MC_MAXPATHLEN) { 
    296296        message (D_ERROR, MSG_ERROR, _("Corrupted cpio header encountered in\n%s"),  
    297297                super->name); 
    298298        return STATUS_FAIL;