From a998d33f7ca68018fea0e4d994509ba509001045 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Mon, 16 Aug 2004 04:26:46 +0000 Subject: [PATCH] Made the implicit conversions explicit to prevent "hidden" bugs. --- vfs/cpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vfs/cpio.c b/vfs/cpio.c index 24420100e..ec254aae5 100644 --- a/vfs/cpio.c +++ b/vfs/cpio.c @@ -311,7 +311,8 @@ static int cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super) } name = g_malloc(hd.c_namesize); - if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) < hd.c_namesize) { + if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) == -1 || + (unsigned long) len < hd.c_namesize) { g_free (name); return STATUS_EOF; } @@ -366,7 +367,8 @@ static int cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super) return STATUS_FAIL; name = g_malloc(hd.c_namesize); - if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) < hd.c_namesize) { + if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) != -1 && + (unsigned long) len < hd.c_namesize) { g_free (name); return STATUS_EOF; }