From 56520fda0f86e193368459f1493eb5f1838f2543 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Fri, 7 Jun 2013 16:48:14 +0300 Subject: [PATCH] Ticket #3016: Segfault while entering into extfs archive Current master (4.8.8-49-g6b64835) segfaults while entering into any extfs archive (zip, rar, etc). Bad commit is 2640b21bb9700aa51a70f35f9e10732c82a7366f. Signed-off-by: Slava Zanko --- src/vfs/extfs/extfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vfs/extfs/extfs.c b/src/vfs/extfs/extfs.c index 162be497f..be3662288 100644 --- a/src/vfs/extfs/extfs.c +++ b/src/vfs/extfs/extfs.c @@ -666,6 +666,7 @@ extfs_which (struct vfs_class *me, const char *path) static const char * extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean do_not_open) { + char *archive_name; int result = -1; struct archive *parc; int fstype; @@ -677,6 +678,8 @@ extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean if (fstype == -1) return NULL; + archive_name = vfs_path_to_str_elements_count (vpath, -1); + /* * All filesystems should have some local archive, at least * it can be PATH_SEP ('/'). @@ -684,14 +687,15 @@ extfs_get_path_int (const vfs_path_t * vpath, struct archive **archive, gboolean for (parc = first_archive; parc != NULL; parc = parc->next) if (parc->name != NULL) { - if (strcmp (parc->name, vfs_path_as_str (vpath)) == 0) + if (strcmp (parc->name, archive_name) == 0) { vfs_stamp (&vfs_extfs_ops, (vfsid) parc); goto return_success; } } - result = do_not_open ? -1 : extfs_read_archive (fstype, vfs_path_as_str (vpath), &parc); + result = do_not_open ? -1 : extfs_read_archive (fstype, archive_name, &parc); + g_free (archive_name); if (result == -1) { path_element->class->verrno = EIO;