Re: #286990: mc: crashes with ssegv trying to open (vfs) .lzh arc



Hello, Paolo!

Test attached extfs.c.patch, please.
I am not sure about ulha.in.patch, but this one fix at least contiki.lzh issue.
Also contiki.lzh.lslR is attached as extfs.c testcase.

Thanks for report.

-- 
Regards,
Andrew V. Samoilov

________________________________________________________________
GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua
Join BCS today! For your FREE webmail, visit: http://email.zp.ua/
vfs/ChangeLog:

	* extfs.c (extfs_generate_entry): Initialize inode->last_in_subdir.
	(extfs_read_archive): Likewise. Remove unneeded test.
	Fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=286990

--- mc/vfs/extfs.c~	Thu Sep  2 09:20:52 2004
+++ mc/vfs/extfs.c	Fri Dec 24 13:53:42 2004
@@ -132,10 +132,9 @@ static void extfs_make_dots (struct entr
     entry->dir = ent;
     inode->local_filename = NULL;
     inode->first_in_subdir = entry;
-    inode->last_in_subdir = entry;
     inode->nlink++;
     entry->next_in_dir = g_new (struct entry, 1);
-    entry=entry->next_in_dir;
+    entry = entry->next_in_dir;
     entry->name = g_strdup ("..");
     inode->last_in_subdir = entry;
     entry->next_in_dir = NULL;
@@ -170,7 +169,8 @@ static struct entry *extfs_generate_entr
     inode = g_new (struct inode, 1);
     entry->inode = inode;
     inode->local_filename = NULL;
-    inode->linkname = 0;
+    inode->linkname = NULL;
+    inode->last_in_subdir = NULL;
     inode->inode = (archive->inode_counter)++;
     inode->dev = archive->rdev;
     inode->archive = archive;
@@ -350,11 +351,9 @@ extfs_read_archive (int fstype, const ch
 		entry->name = g_strdup (p);
 		entry->next_in_dir = NULL;
 		entry->dir = pent;
-		if (pent != NULL) {
-		    if (pent->inode->last_in_subdir) {
-			pent->inode->last_in_subdir->next_in_dir = entry;
-			pent->inode->last_in_subdir = entry;
-		    }
+		if (pent->inode->last_in_subdir) {
+		    pent->inode->last_in_subdir->next_in_dir = entry;
+		    pent->inode->last_in_subdir = entry;
 		}
 		if (!S_ISLNK (hstat.st_mode) && current_link_name != NULL) {
 		    pent =
@@ -391,6 +390,8 @@ extfs_read_archive (int fstype, const ch
 		    inode->mtime = hstat.st_mtime;
 		    inode->atime = hstat.st_atime;
 		    inode->ctime = hstat.st_ctime;
+		    inode->first_in_subdir = NULL;
+		    inode->last_in_subdir = NULL;
 		    if (current_link_name != NULL
 			&& S_ISLNK (hstat.st_mode)) {
 			inode->linkname = current_link_name;
vfs/ChangeLog:

	* extfs/ulha.in (mc_lha_fs_list): Use $NF instead of $10
	as filename for permission intention.
	Fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=286990

--- ulha.in	Thu Nov 11 09:35:53 2004
+++ ulha.in	Fri Dec 24 12:38:13 2004
@@ -46,7 +46,7 @@ mc_lha_fs_list()
       # Print the line this way if there is no permission string
       $1 ~ /^\[.*\]/ {
          # Invent a generic permission
-         $1 = ($10 ~ /\/$/) ? "drwxr-xr-x":"-rwxr--r--";
+         $1 = ($NF ~ /\/$/) ? "drwxr-xr-x":"-rwxr--r--";
          # Print it
          printf "%s 1 %-8s %-8s %-8d %s %s %s %s\n",
                  $1, uid, gid, $2, $4, $5, $6, $7;
-rwxr--r-- 1 sav      sav      0        Jul 30 2003 contiki/arch/
-rwxr--r-- 1 sav      sav      0        Jul 30 2003 contiki/arch/pc/
-rwxr--r-- 1 sav      sav      3561     Jul 29 2003 contiki/arch/pc/ctk-pc.c
-rwxr--r-- 1 sav      sav      2354     Jul 29 2003 contiki/arch/pc/ctk-arch.h
-rwxr--r-- 1 sav      sav      4987     Jul 28 2003 contiki/arch/pc/ctk-coni.h
-rwxr--r-- 1 sav      sav      2240     Jan 15 2003 contiki/arch/pc/uip_arch.h
-rwxr--r-- 1 sav      sav      5425     Apr 12 2003 contiki/arch/pc/uip_arch.c
-rwxr--r-- 1 sav      sav      14744    Jul 29 2003 contiki/arch/pc/ctk-gene.c
-rwxr--r-- 1 sav      sav      3441     Apr 12 2003 contiki/arch/pc/rs232dev.c
-rwxr--r-- 1 sav      sav      330      Dec 28 2002 contiki/arch/pc/rs232dev.h
-rwxr--r-- 1 sav      sav      0        Jul 30 2003 contiki/arch/pofo/
-rwxr--r-- 1 sav      sav      2546     Jul 28 2003 contiki/arch/pofo/ctk-coni.h
-rwxr--r-- 1 sav      sav      14238    Apr 26 2003 contiki/arch/pofo/ctk-coni.c
-rwxr--r-- 1 sav      sav      2405     Jul 29 2003 contiki/arch/pofo/ctk-arch.h
-rwxr--r-- 1 sav      sav      4646     Jul 29 2003 contiki/arch/pofo/ctk-pofo.c
-rwxr--r-- 1 sav      sav      0        Jul 30 2003 contiki/arch/st/
-rwxr--r-- 1 sav      sav      15202    Apr 13 2003 contiki/arch/st/ctk-vt52.c
-rwxr--r-- 1 sav      sav      2240     Jan 15 2003 contiki/arch/st/uip_arch.h
-rwxr--r-- 1 sav      sav      3429     Apr 13 2003 contiki/arch/st/ctk-st.c
-rwxr--r-- 1 sav      sav      5634     Mar 7 2003 contiki/arch/st/ctk-conf.h
-rwxr--r-- 1 sav      sav      2275     Apr 3 2003 contiki/arch/st/ctk-arch.h
-rwxr--r-- 1 sav      sav      3146     Apr 14 2003 contiki/arch/st/rs232dev.c
-rwxr--r-- 1 sav      sav      330      Dec 28 2002 contiki/arch/st/rs232dev.h
-rwxr--r-- 1 sav      sav      5429     Apr 14 2003 contiki/arch/st/uip_arch.c
-rwxr--r-- 1 sav      sav      3395     Apr 6 2003 contiki/makefile
-rwxr--r-- 1 sav      sav      36       Apr 12 2003 contiki/build.bat
-rwxr--r-- 1 sav      sav      3040     Apr 12 2003 contiki/con-pc.c
-rwxr--r-- 1 sav      sav      3093     Jul 28 2003 contiki/con-pofo.c
-rwxr--r-- 1 sav      sav      38778    Jul 29 2003 contiki/pc.exe
-rwxr--r-- 1 sav      sav      196      Jul 1 2003 contiki/config.h
-rwxr--r-- 1 sav      sav      39002    Jul 29 2003 contiki/pofo.exe
-rwxr--r-- 1 sav      sav      461      Apr 16 2003 contiki/pc.rsp
-rwxr--r-- 1 sav      sav      496      Apr 14 2003 contiki/contiki.prj
-rwxr--r-- 1 sav      sav      31589    Apr 14 2003 contiki/contiki.tos
-rwxr--r-- 1 sav      sav      0        Jul 30 2003 contiki/make/
-rwxr--r-- 1 sav      sav      4356     Apr 16 2003 contiki/make/makefile.pc
-rwxr--r-- 1 sav      sav      4379     Apr 16 2003 contiki/make/makefile.pof
-rwxr--r-- 1 sav      sav      498      Jul 28 2003 contiki/pofo.rsp


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