[tracker/wip/carlosg/service-fixes: 6/8] libtracker-data: Check further the DBus name in SERVICE uris



commit 926e34aefed8d1c71edaa72b9cb7a7943e9c1399
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 9 17:51:24 2020 +0200

    libtracker-data: Check further the DBus name in SERVICE uris
    
    Fail with invalid DBus names, and make these PARSE errors.
    
    Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/217

 src/libtracker-data/tracker-vtab-service.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-vtab-service.c b/src/libtracker-data/tracker-vtab-service.c
index 8e0a0b992..51a257384 100644
--- a/src/libtracker-data/tracker-vtab-service.c
+++ b/src/libtracker-data/tracker-vtab-service.c
@@ -346,12 +346,21 @@ service_filter (sqlite3_vtab_cursor  *vtab_cursor,
                                                  &bus_name, &object_path)) {
                        g_set_error (&error,
                                     TRACKER_SPARQL_ERROR,
-                                    TRACKER_SPARQL_ERROR_UNSUPPORTED,
+                                    TRACKER_SPARQL_ERROR_PARSE,
                                     "Failed to parse uri '%s'",
                                     cursor->service);
                        goto fail;
                }
 
+               if (!g_dbus_is_name (bus_name)) {
+                       g_set_error (&error,
+                                    TRACKER_SPARQL_ERROR,
+                                    TRACKER_SPARQL_ERROR_PARSE,
+                                    "Invalid bus name '%s'",
+                                    bus_name);
+                       goto fail;
+               }
+
                dbus_connection = g_bus_get_sync (bus_type, NULL, &error);
                if (!dbus_connection)
                        goto fail;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]