From 8a060eab03fe5500bd6ac117a9346a5289c903ce Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 6 Oct 2008 12:24:18 +0000 Subject: Patch from Andreas Henriksson (from trunk) 2008-10-06 Alexander Larsson Patch from Andreas Henriksson (from trunk) * daemon/gvfsbackendftp.c: (dir_default_iter_new): (dir_default_iter_process): Don't read past start of filename. (#545971) svn path=/branches/gnome-2-24/; revision=2044 --- ChangeLog | 9 +++++++++ daemon/gvfsbackendftp.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e550ee24..220b89cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-06 Alexander Larsson + + Patch from Andreas Henriksson + + * daemon/gvfsbackendftp.c: + (dir_default_iter_new): + (dir_default_iter_process): + Don't read past start of filename. (#545971) + 2008-09-29 David Zeuthen * monitor/hal/ghalvolume.c: diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c index b75e01ef..fe4d02de 100644 --- a/daemon/gvfsbackendftp.c +++ b/daemon/gvfsbackendftp.c @@ -979,7 +979,7 @@ dir_default_get_root (FtpConnection *conn) static gpointer dir_default_iter_new (FtpConnection *conn) { - return g_slice_new (struct list_state); + return g_slice_new0 (struct list_state); } static GFileInfo * @@ -1062,9 +1062,15 @@ dir_default_iter_process (gpointer iter, char *end = str + 4; char *start; start = str - 1; - while (*start != '/') + while (start >= symlink_file && *start != '/') start--; - memcpy (start + 1, end, strlen (end) + 1); + + if (start < symlink_file) { + *symlink_file = '/'; + start = symlink_file; + } + + memmove (start + 1, end, strlen (end) + 1); } str = symlink_file + strlen (symlink_file) - 1; while (*str == '/' && str > symlink_file) -- cgit v1.2.1