Re: Crash in vfs_s_close()



Hi!

> > I was playing with compressed cpio files on fish and soon after that MC
> > crashed.  I cannot reproduce this problem.

I remember that some broken cpio archives were involved.  I could
reproduce the problem when MC crashes immediately on entering a truncated
cpio archive on ftpfs (that time it was fish).

I don't know if this bug is related (I think 20% probability that it is),
but I'm fixing it anyway.

------------------------------------------
--- ChangeLog
+++ ChangeLog
@@ -1 +1,6 @@
+2001-08-18  Pavel Roskin  <proski gnu org>
+
+	* cpio.c (cpio_read_head): Check return value of cpio_find_head,
+	because it's not equal to super->u.cpio.type in case of errors.
+
 2001-08-16  Pavel Roskin  <proski gnu org>
--- cpio.c
+++ cpio.c
@@ -183,8 +183,7 @@ static int cpio_open_cpio_file(vfs *me,

 static int cpio_read_head(vfs *me, vfs_s_super *super)
 {
-    cpio_find_head(me, super);
-    switch(super->u.cpio.type) {
+    switch(cpio_find_head(me, super)) {
     case CPIO_UNKNOWN:
 	return -1;
     case CPIO_BIN:
------------------------------------------

By the way, fh->changed=129 clearly indicates memory corruption.  The code
only assigns 0 and 1 to it.

-- 
Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]