[tracker/wip/carlosg/bus-fixes: 1/4] libtracker-sparql/bus: Initialize string length out value in all paths




commit 87d5b79fafc4e630459f2bf416ef553cbd0584b4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 19 18:46:37 2022 +0200

    libtracker-sparql/bus: Initialize string length out value in all paths
    
    Fill in the out parameter in tracker_sparql_cursor_get_string() also
    on NULL strings. We used to do that, and even had code that internally
    relied on that.
    
    Fixes accessing through the portal after the bus connection rewrite,
    since the TrackerEndpointDBus in the portal would rely on prior
    behavior to correctly write the cursor to the sandboxed client.
    
    Sadly, our puny portal tests didn't catch this situation.

 src/libtracker-sparql/bus/tracker-bus-cursor.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/libtracker-sparql/bus/tracker-bus-cursor.c b/src/libtracker-sparql/bus/tracker-bus-cursor.c
index 0a006683e..0dc9282c8 100644
--- a/src/libtracker-sparql/bus/tracker-bus-cursor.c
+++ b/src/libtracker-sparql/bus/tracker-bus-cursor.c
@@ -159,6 +159,9 @@ tracker_bus_cursor_get_string (TrackerSparqlCursor *cursor,
        TrackerBusCursor *bus_cursor = TRACKER_BUS_CURSOR (cursor);
        const gchar *str;
 
+       if (len)
+               *len = 0;
+
        if (bus_cursor->finished)
                return NULL;
        if (column < 0 || column >= bus_cursor->n_columns)


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