diff --git a/vfs/ChangeLog b/vfs/ChangeLog index e966d79d6..9eceabb35 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +2001-10-30 Andrew V. Samoilov + + * cpio.c (cpio_read_bin_head): Release name if mc_read fails. + (cpio_read_crc_head): Likewise. + 2001-10-25 Andrew V. Samoilov * cpio.c (cpio_read_crc_head): Fix buffer overflow. diff --git a/vfs/cpio.c b/vfs/cpio.c index d72283eba..e44c1f6fc 100644 --- a/vfs/cpio.c +++ b/vfs/cpio.c @@ -263,9 +263,10 @@ static int cpio_read_bin_head(vfs *me, vfs_s_super *super) g_assert(buf.c_magic == 070707); name = g_malloc(buf.c_namesize); - if((len = mc_read(super->u.cpio.fd, name, buf.c_namesize)) < buf.c_namesize) + if((len = mc_read(super->u.cpio.fd, name, buf.c_namesize)) < buf.c_namesize){ + g_free(name); return STATUS_EOF; - + } CPIO_POS(super) += len; cpio_skip_padding(super); @@ -365,9 +366,10 @@ static int cpio_read_crc_head(vfs *me, vfs_s_super *super) return STATUS_FAIL; name = g_malloc(hd.c_namesize); - if((len = mc_read(super->u.cpio.fd, name, hd.c_namesize)) < hd.c_namesize) + if((len = mc_read(super->u.cpio.fd, name, hd.c_namesize)) < hd.c_namesize){ + g_free (name); return STATUS_EOF; - + } CPIO_POS(super) += len; cpio_skip_padding(super);