summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2007-10-09 11:18:34 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-10-09 11:18:34 +0000
commit6a37b21bc9d308786c5dd5f7ace622f4e8fabec4 (patch)
tree83392f85c5483b9d1e3a98fe401283518b6ba246 /daemon
parentf27f5feaf3993d76b9294d13f8cbab13632ad7b4 (diff)
downloadgvfs-6a37b21bc9d308786c5dd5f7ace622f4e8fabec4.tar.gz
Correctly handle len arg in unescape_pathname
2007-10-09 Alexander Larsson <alexl@redhat.com> * daemon/gvfsbackendtrash.c: Correctly handle len arg in unescape_pathname svn path=/trunk/; revision=976
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsbackendtrash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c
index 52ee5bc4..5f6f5f69 100644
--- a/daemon/gvfsbackendtrash.c
+++ b/daemon/gvfsbackendtrash.c
@@ -125,8 +125,13 @@ unescape_pathname (const char *escaped_dir, int len)
len = strlen (escaped_dir);
/* If first char is _ this is a homedir trash file */
- if (*escaped_dir == '_')
- return g_build_filename (g_get_user_data_dir (), "Trash", escaped_dir + 1, NULL);
+ if (len > 1 && *escaped_dir == '_')
+ {
+ char *trashname;
+ trashname = g_strndup (escaped_dir + 1, len - 1);
+ return g_build_filename (g_get_user_data_dir (), "Trash", trashname, NULL);
+ g_free (trashname);
+ }
dir = g_malloc (len + 1 + 1);