Linux bluetooth development
 help / color / mirror / Atom feed
* obexd broken for absolute paths
@ 2013-11-08 19:21 Bastien Nocera
  2013-11-09 17:17 ` Bastien Nocera
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien Nocera @ 2013-11-08 19:21 UTC (permalink / raw)
  To: linux-bluetooth

Heya,

I was trying to test gnome-user-share's Bluetooth support for BlueZ 5,
and was quite surprised it didn't work one bit, with transfers failing
as soon as they were created.

I made this simple change to test/simple-obex-agent so you could
replicate the failure. Obviously, change the download path to exist on
your system:
-               return properties['Name']
+               return ("%s/%s" % ("/home/hadess/Downloads/", properties['Name']))

This will see OBEX Push transfers fail as soon as accepted.

I must also mention the dreadful code in agent_reply() in obexd/src/manager.c:
                const char *slash = strrchr(name, '/');
                DBG("Agent replied with %s", name);
                if (!slash) {
                        agent->new_name = g_strdup(name);
                        agent->new_folder = NULL;
                } else {
                        agent->new_name = g_strdup(slash + 1); 
                        agent->new_folder = g_strndup(name, slash - name);
                }

Please use g_path_get_basename() and g_path_get_dirname(). This is even
a security issue because I could pass relative paths and expect some
system file to get overwritten.

Cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-10  0:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 19:21 obexd broken for absolute paths Bastien Nocera
2013-11-09 17:17 ` Bastien Nocera
2013-11-09 18:35   ` Luiz Augusto von Dentz
2013-11-09 21:00     ` Bastien Nocera
2013-11-10  0:49       ` Luiz Augusto von Dentz
2013-11-10  0:59         ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox