]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-send: Print an error message if object path is syntactically invalid
authorSimon McVittie <smcv@collabora.com>
Mon, 21 Jun 2021 11:02:27 +0000 (12:02 +0100)
committerSimon McVittie <smcv@collabora.com>
Mon, 21 Jun 2021 11:02:27 +0000 (12:02 +0100)
    $ dbus-send // nope
    Object path was not valid: '//'

Related to dbus#338.

Signed-off-by: Simon McVittie <smcv@collabora.com>
tools/dbus-send.c

index 343fd75a2e5e90f2fdd350b4b2f9c3058ef54406..b6b2d6757186bbc2e7b8a6ab6f2d554828bae8d1 100644 (file)
@@ -417,6 +417,13 @@ main (int argc, char *argv[])
       usage (1);
     }
 
+  if (!dbus_validate_path (path, &error))
+    {
+      fprintf (stderr, "%s\n", error.message);
+      dbus_error_free (&error);
+      exit (1);
+    }
+
   if (address != NULL)
     {
       connection = dbus_connection_open (address, &error);