diff --git a/ChangeLog b/ChangeLog index e4ebf63e8c40210d8115194f79ceb811753aca4b..a1af97e74fdc9e280641d13e05542fc84a51dd75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-11 Benedikt Meurer <benny@xfce.org> + + * thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_list_to_string): Fix + crash when transfering a lot of files via DnD or clipbord. Bug #2356. + 2006-11-11 Benedikt Meurer <benny@xfce.org> * plugins/thunar-tpa/Makefile.am: Starting with version 0.72 diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c index a06f6f6722c2824d4021516218fd618fdd62c4a5..f5e8ff1b6894731b6656731f2ff3dc435da387eb 100644 --- a/thunar-vfs/thunar-vfs-path.c +++ b/thunar-vfs/thunar-vfs-path.c @@ -1058,21 +1058,28 @@ thunar_vfs_path_list_to_string (GList *path_list) { for (;;) { - /* increase the buffer automatically if required (already including the line break) */ - n = thunar_vfs_path_to_uri (lp->data, buffer + bufpos, bufsize - (bufpos + 2), NULL); - if (G_UNLIKELY (n < 0)) + /* determine the size required to store the URI and the line break */ + n = thunar_vfs_path_escape_uri_length (lp->data) + 2; + if (n > (bufsize - bufpos)) { + /* automatically increase the buffer */ bufsize += 512; buffer = g_realloc (buffer, bufsize + 1); continue; } + /* append the URI to the buffer */ + n = thunar_vfs_path_escape_uri (lp->data, buffer + bufpos); + /* shift the buffer position */ bufpos += (n - 1); /* append a line break */ buffer[bufpos++] = '\r'; buffer[bufpos++] = '\n'; + + /* sanity checks */ + _thunar_vfs_assert (bufpos <= bufsize); break; } }