Hello community,

here is the log from the commit of package geoclue2 for openSUSE:Factory 
checked in at 2020-12-15 12:30:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/geoclue2 (Old)
 and      /work/SRC/openSUSE:Factory/.geoclue2.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "geoclue2"

Tue Dec 15 12:30:21 2020 rev:37 rq:855674 version:2.5.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/geoclue2/geoclue2.changes        2019-12-23 
22:37:28.453821101 +0100
+++ /work/SRC/openSUSE:Factory/.geoclue2.new.2328/geoclue2.changes      
2020-12-15 12:32:40.492111037 +0100
@@ -1,0 +2,13 @@
+Sun Dec 13 13:01:31 UTC 2020 - Bjørn Lie <bjorn....@gmail.com>
+
+- Update to version 2.5.6:
+  + Fix crashes in WiFi handling code.
+  + Plug a leak.
+- Changes from version 2.5.5:
+  + Plug another leak.
+  + Fix another buffer overflow.
+  + Fix WiFi-geolocation that got broken in 2.5.4.
+  + Put freequently used small strings on the stack to avoid
+    excessive memory usage.
+
+-------------------------------------------------------------------

Old:
----
  geoclue-2.5.4.tar.bz2

New:
----
  geoclue-2.5.6.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ geoclue2.spec ++++++
--- /var/tmp/diff_new_pack.HynN1h/_old  2020-12-15 12:32:41.148111565 +0100
+++ /var/tmp/diff_new_pack.HynN1h/_new  2020-12-15 12:32:41.152111568 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package geoclue2
 #
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,8 +17,9 @@
 
 
 %define _name geoclue
+
 Name:           geoclue2
-Version:        2.5.4
+Version:        2.5.6
 Release:        0
 Summary:        GeoLocation Framework
 License:        GPL-2.0-or-later

++++++ geoclue-2.5.4.tar.bz2 -> geoclue-2.5.6.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/NEWS new/geoclue-2.5.6/NEWS
--- old/geoclue-2.5.4/NEWS      2019-09-27 18:26:59.000000000 +0200
+++ new/geoclue-2.5.6/NEWS      2020-02-26 14:19:24.000000000 +0100
@@ -1,3 +1,25 @@
+2.5.6
+=====
+
+- Fix crashes in WiFi handling code.
+- Plug a leak.
+
+Contributors:
+
+Amaury Pouly <amaury.po...@gmail.com>
+Jan Alexander Steffens (heftig) <jan.steff...@gmail.com>
+Will Thompson <w...@willthompson.co.uk>
+Zeeshan Ali <zeesha...@gnome.org>
+
+2.5.5
+=====
+
+- Plug another leak.
+- Fix another buffer overflow.
+- Fix WiFi-geolocation that got broken in 2.5.4.
+- Put freequently used small strings on the stack to avoid excessive memory
+  usage.
+
 2.5.4
 =====
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/geoclue-2.5.4/interface/org.freedesktop.GeoClue2.Client.xml 
new/geoclue-2.5.6/interface/org.freedesktop.GeoClue2.Client.xml
--- old/geoclue-2.5.4/interface/org.freedesktop.GeoClue2.Client.xml     
2019-09-27 18:26:59.000000000 +0200
+++ new/geoclue-2.5.6/interface/org.freedesktop.GeoClue2.Client.xml     
2020-02-26 14:19:24.000000000 +0100
@@ -39,7 +39,7 @@
         Contains the current distance threshold in meters. This value is used
         by the service when it gets new location info. If the distance moved is
         below the threshold, it won't emit the LocationUpdated signal.
-        The default value is 0. When TimeThreshold is zero, it always emits
+        The default value is 0. When DistanceThreshold is zero, it always emits
         the signal.
     -->
     <property name="DistanceThreshold" type="u" access="readwrite">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/meson.build 
new/geoclue-2.5.6/meson.build
--- old/geoclue-2.5.4/meson.build       2019-09-27 18:26:59.000000000 +0200
+++ new/geoclue-2.5.6/meson.build       2020-02-26 14:19:24.000000000 +0100
@@ -1,4 +1,4 @@
-project('geoclue', 'c', version: '2.5.3', meson_version : '>= 0.47.2')
+project('geoclue', 'c', version: '2.5.6', meson_version : '>= 0.47.2')
 
 gclue_version = meson.project_version()
 ver_arr = gclue_version.split('.')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/src/gclue-config.c 
new/geoclue-2.5.6/src/gclue-config.c
--- old/geoclue-2.5.4/src/gclue-config.c        2019-09-27 18:26:59.000000000 
+0200
+++ new/geoclue-2.5.6/src/gclue-config.c        2020-02-26 14:19:24.000000000 
+0100
@@ -232,7 +232,8 @@
                                                 "url",
                                                 &error);
         if (error != NULL) {
-                g_warning ("%s", error->message);
+                g_debug ("Failed to get config \"wifi/url\": %s",
+                         error->message);
                 g_clear_error (&error);
                 priv->wifi_url = g_strdup (DEFAULT_WIFI_URL);
         }
@@ -242,7 +243,7 @@
                                                     "submit-data",
                                                     &error);
         if (error != NULL) {
-                g_debug ("Failed to get config wifi/submit-data: %s",
+                g_debug ("Failed to get config \"wifi/submit-data\": %s",
                          error->message);
                 g_error_free (error);
 
@@ -254,8 +255,9 @@
                                                        "submission-url",
                                                        &error);
         if (error != NULL) {
-                g_debug ("No wifi submission URL: %s", error->message);
-                g_error_free (error);
+                g_debug ("Failed to get config \"wifi/submission-url\": %s",
+                         error->message);
+                g_clear_error (&error);
                 priv->wifi_submit_url = g_strdup (DEFAULT_WIFI_SUBMIT_URL);
         }
 
@@ -264,7 +266,8 @@
                                                         "submission-nick",
                                                         &error);
         if (error != NULL) {
-                g_debug ("No wifi submission nick: %s", error->message);
+                g_debug ("Failed to get config \"wifi/submission-nick\": %s",
+                         error->message);
                 g_error_free (error);
         }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/src/gclue-location-source.c 
new/geoclue-2.5.6/src/gclue-location-source.c
--- old/geoclue-2.5.4/src/gclue-location-source.c       2019-09-27 
18:26:59.000000000 +0200
+++ new/geoclue-2.5.6/src/gclue-location-source.c       2020-02-26 
14:19:24.000000000 +0100
@@ -290,7 +290,7 @@
         if (source->priv->active_counter > 1) {
                 g_debug ("%s already active, not starting.",
                          G_OBJECT_TYPE_NAME (source));
-                return FALSE;
+                return TRUE;
         }
 
         if (source->priv->compute_movement) {
@@ -313,7 +313,7 @@
         if (source->priv->active_counter == 0) {
                 g_debug ("%s already inactive, not stopping.",
                          G_OBJECT_TYPE_NAME (source));
-                return FALSE;
+                return TRUE;
         }
 
         source->priv->active_counter--;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/src/gclue-min-uint.c 
new/geoclue-2.5.6/src/gclue-min-uint.c
--- old/geoclue-2.5.4/src/gclue-min-uint.c      2019-09-27 18:26:59.000000000 
+0200
+++ new/geoclue-2.5.6/src/gclue-min-uint.c      2020-02-26 14:19:24.000000000 
+0100
@@ -181,6 +181,8 @@
                 }
         }
 
+        g_list_free (values);
+
         return value;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/src/gclue-mozilla.c 
new/geoclue-2.5.6/src/gclue-mozilla.c
--- old/geoclue-2.5.4/src/gclue-mozilla.c       2019-09-27 18:26:59.000000000 
+0200
+++ new/geoclue-2.5.6/src/gclue-mozilla.c       2020-02-26 14:19:24.000000000 
+0100
@@ -40,65 +40,66 @@
  * its easy to switch to Google's API.
  **/
 
-static char *
-variant_to_string (GVariant *variant, guint *len)
+#define BSSID_LEN 7
+#define BSSID_STR_LEN 18
+#define MAX_SSID_LEN 32
+
+static guint
+variant_to_string (GVariant *variant, guint max_len, char *ret)
 {
-        guint n_bytes, i;
-        char *ret;
+        guint i;
+        guint len;
 
-        n_bytes = g_variant_n_children (variant);
-        if (len != NULL)
-                *len = n_bytes;
-        if (n_bytes <= 0)
-                return NULL;
-        ret = g_malloc (n_bytes + 1);
-        ret[n_bytes] = '\0';
+        len = g_variant_n_children (variant);
+        if (len == 0)
+                return 0;
+        g_return_val_if_fail(len < max_len, 0);
+        ret[len] = '\0';
 
-        for (i = 0; i < n_bytes; i++)
+        for (i = 0; i < len; i++)
                 g_variant_get_child (variant,
                                      i,
                                      "y",
                                      &ret[i]);
 
-        return ret;
+        return len;
 }
 
-static char *
-get_ssid_from_bss (WPABSS *bss)
+static guint
+get_ssid_from_bss (WPABSS *bss, char *ssid)
 {
         GVariant *variant = wpa_bss_get_ssid (bss);
         if (variant == NULL)
-                return NULL;
+                return 0;
 
-        return variant_to_string (variant, NULL);
+        return variant_to_string (variant, MAX_SSID_LEN, ssid);
 }
 
-static char *
-get_bssid_from_bss (WPABSS *bss)
+static gboolean
+get_bssid_from_bss (WPABSS *bss, char *bssid)
 {
         GVariant *variant;
-        g_autofree char *raw_bssid = NULL;
-        char *bssid;
-        guint raw_len, len, i, j;
+        char raw_bssid[BSSID_LEN] = { 0 };
+        guint raw_len, i;
 
         variant = wpa_bss_get_bssid (bss);
         if (variant == NULL)
-                return NULL;
+                return FALSE;
 
-        raw_bssid = variant_to_string (variant, &raw_len);
-        if (raw_bssid == NULL)
-                return NULL;
+        raw_len = variant_to_string (variant, BSSID_LEN, raw_bssid);
+        g_return_val_if_fail (raw_len == BSSID_LEN - 1, FALSE);
 
-        len = raw_len * 2;
-        bssid = g_malloc (len);
-        for (i = 0, j = 0; i < len - 3; i = i + 2, j++) {
-                unsigned char c = (unsigned char) raw_bssid[j];
+        for (i = 0; i < BSSID_LEN - 1; i++) {
+                unsigned char c = (unsigned char) raw_bssid[i];
 
-                g_snprintf (bssid + i, 3, "%02x:", c);
+                if (i == BSSID_LEN - 2) {
+                        g_snprintf (bssid + (i * 3), 3, "%02x", c);
+                } else {
+                        g_snprintf (bssid + (i * 3), 4, "%02x:", c);
+                }
         }
-        bssid[len - 1] = '\0';
 
-        return bssid;
+        return TRUE;
 }
 
 static const char *
@@ -162,7 +163,7 @@
 
                 for (iter = bss_list; iter != NULL; iter = iter->next) {
                         WPABSS *bss = WPA_BSS (iter->data);
-                        char *mac;
+                        char mac[BSSID_STR_LEN] = { 0 };
                         gint16 strength_dbm;
 
                         if (gclue_mozilla_should_ignore_bss (bss))
@@ -170,9 +171,8 @@
 
                         json_builder_begin_object (builder);
                         json_builder_set_member_name (builder, "macAddress");
-                        mac = get_bssid_from_bss (bss);
+                        get_bssid_from_bss (bss, mac);
                         json_builder_add_string_value (builder, mac);
-                        g_free (mac);
 
                         json_builder_set_member_name (builder, 
"signalStrength");
                         strength_dbm = wpa_bss_get_signal (bss);
@@ -336,7 +336,7 @@
 
                 for (iter = bss_list; iter != NULL; iter = iter->next) {
                         WPABSS *bss = WPA_BSS (iter->data);
-                        char *mac;
+                        char mac[BSSID_STR_LEN] = { 0 };
                         gint16 strength_dbm;
                         guint16 frequency;
 
@@ -345,9 +345,8 @@
 
                         json_builder_begin_object (builder);
                         json_builder_set_member_name (builder, "key");
-                        mac = get_bssid_from_bss (bss);
+                        get_bssid_from_bss (bss, mac);
                         json_builder_add_string_value (builder, mac);
-                        g_free (mac);
 
                         json_builder_set_member_name (builder, "signal");
                         strength_dbm = wpa_bss_get_signal (bss);
@@ -416,16 +415,17 @@
 gboolean
 gclue_mozilla_should_ignore_bss (WPABSS *bss)
 {
-        g_autofree char *ssid = NULL, *bssid = NULL;
+        char ssid[MAX_SSID_LEN] = { 0 };
+        char bssid[BSSID_STR_LEN] = { 0 };
+        guint len;
 
-        bssid = get_bssid_from_bss (bss);
-        if (bssid == NULL) {
+        if (!get_bssid_from_bss (bss, bssid)) {
                 g_debug ("Ignoring WiFi AP with unknown BSSID..");
                 return TRUE;
         }
 
-        ssid = get_ssid_from_bss (bss);
-        if (ssid == NULL || g_str_has_suffix (ssid, "_nomap")) {
+        len = get_ssid_from_bss (bss, ssid);
+        if (len == 0 || g_str_has_suffix (ssid, "_nomap")) {
                 g_debug ("SSID for WiFi AP '%s' missing or has '_nomap' 
suffix."
                          ", Ignoring..",
                          bssid);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/geoclue-2.5.4/src/gclue-wifi.c 
new/geoclue-2.5.6/src/gclue-wifi.c
--- old/geoclue-2.5.4/src/gclue-wifi.c  2019-09-27 18:26:59.000000000 +0200
+++ new/geoclue-2.5.6/src/gclue-wifi.c  2020-02-26 14:19:24.000000000 +0100
@@ -34,6 +34,10 @@
  */
 #define WIFI_SCAN_TIMEOUT_LOW_ACCURACY  300
 
+#define BSSID_LEN 7
+#define BSSID_STR_LEN 18
+#define MAX_SSID_LEN 32
+
 /**
  * SECTION:gclue-wifi
  * @short_description: WiFi-based geolocation
@@ -192,58 +196,60 @@
               GVariant     *properties,
               gpointer      user_data);
 
-static char *
-variant_to_string (GVariant *variant, guint *len)
+static guint
+variant_to_string (GVariant *variant, guint max_len, char *ret)
 {
-        guint n_bytes, i;
-        char *ret;
+        guint i;
+        guint len;
 
-        n_bytes = g_variant_n_children (variant);
-        if (len != NULL)
-                *len = n_bytes;
-        if (n_bytes <= 0)
-                return NULL;
-        ret = g_malloc (n_bytes + 1);
-        ret[n_bytes] = '\0';
+        len = g_variant_n_children (variant);
+        if (len == 0)
+                return 0;
+        g_return_val_if_fail(len < max_len, 0);
+        ret[len] = '\0';
 
-        for (i = 0; i < n_bytes; i++)
+        for (i = 0; i < len; i++)
                 g_variant_get_child (variant,
                                      i,
                                      "y",
                                      &ret[i]);
 
-        return ret;
+        return len;
 }
 
-static char *
-get_ssid_from_bss (WPABSS *bss)
+static guint
+get_ssid_from_bss (WPABSS *bss, char *ssid)
 {
         GVariant *variant = wpa_bss_get_ssid (bss);
 
-        return variant_to_string (variant, NULL);
+        return variant_to_string (variant, MAX_SSID_LEN, ssid);
 }
 
-static char *
-get_bssid_from_bss (WPABSS *bss)
+static gboolean
+get_bssid_from_bss (WPABSS *bss, char *bssid)
 {
         GVariant *variant;
-        char *raw_bssid;
-        char *bssid;
-        guint raw_len, len, i, j;
+        char raw_bssid[BSSID_LEN] = { 0 };
+        guint raw_len, i;
 
         variant = wpa_bss_get_bssid (bss);
+        if (variant == NULL)
+                return FALSE;
 
-        raw_bssid = variant_to_string (variant, &raw_len);
-        len = raw_len * 2 + raw_len;
-        bssid = g_malloc (len);
-        for (i = 0, j = 0; i < len; i = i + 3, j++)
-                g_snprintf (bssid + i,
-                            4,
-                           "%02x:",
-                           (unsigned char) raw_bssid[j]);
-        bssid[len - 1] = '\0';
+        raw_len = variant_to_string (variant, BSSID_LEN, raw_bssid);
+        g_return_val_if_fail (raw_len == BSSID_LEN - 1, FALSE);
 
-        return bssid;
+        for (i = 0; i < BSSID_LEN - 1; i++) {
+                unsigned char c = (unsigned char) raw_bssid[i];
+
+                if (i == BSSID_LEN - 2) {
+                        g_snprintf (bssid + (i * 3), 3, "%02x", c);
+                } else {
+                        g_snprintf (bssid + (i * 3), 4, "%02x:", c);
+                }
+        }
+
+        return TRUE;
 }
 
 static void
@@ -256,12 +262,11 @@
         if (g_hash_table_replace (wifi->priv->bss_proxies,
                                   g_strdup (path),
                                   bss)) {
-                char *ssid;
+                char ssid[MAX_SSID_LEN] = { 0 };
 
                 wifi->priv->bss_list_changed = TRUE;
-                ssid = get_ssid_from_bss (bss);
+                get_ssid_from_bss (bss, ssid);
                 g_debug ("WiFi AP '%s' added.", ssid);
-                g_free (ssid);
         }
 }
 
@@ -275,12 +280,13 @@
         const char *path;
 
         if (wpa_bss_get_signal (bss) <= -90) {
-                char *bssid = get_bssid_from_bss (bss);
+                char bssid[BSSID_STR_LEN] = { 0 };
+
+                get_bssid_from_bss (bss, bssid);
                 g_debug ("WiFi AP '%s' still has very low strength (%u dBm)"
                          ", ignoring again..",
                          bssid,
                          wpa_bss_get_signal (bss));
-                g_free (bssid);
                 return;
         }
 
@@ -300,7 +306,7 @@
         GClueWifi *wifi = GCLUE_WIFI (user_data);
         WPABSS *bss;
         GError *error = NULL;
-        char *ssid;
+        char ssid[MAX_SSID_LEN] = { 0 };
 
         bss = wpa_bss_proxy_new_for_bus_finish (res, &error);
         if (bss == NULL) {
@@ -316,18 +322,18 @@
                 return;
         }
 
-        ssid = get_ssid_from_bss (bss);
+        get_ssid_from_bss (bss, ssid);
         g_debug ("WiFi AP '%s' added.", ssid);
-        g_free (ssid);
 
         if (wpa_bss_get_signal (bss) <= -90) {
                 const char *path;
-                char *bssid = get_bssid_from_bss (bss);
+                char bssid[BSSID_STR_LEN] = { 0 };
+
+                get_bssid_from_bss (bss, bssid);
                 g_debug ("WiFi AP '%s' has very low strength (%u dBm)"
                          ", ignoring for now..",
                          bssid,
                          wpa_bss_get_signal (bss));
-                g_free (bssid);
                 g_signal_connect (G_OBJECT (bss),
                                   "notify::signal",
                                   G_CALLBACK (on_bss_signal_notify),
@@ -360,16 +366,15 @@
 static gboolean
 remove_bss_from_hashtable (const gchar *path, GHashTable *hash_table)
 {
-        char *ssid;
+        char ssid[MAX_SSID_LEN] = { 0 };
         WPABSS *bss = NULL;
 
         bss = g_hash_table_lookup (hash_table, path);
         if (bss == NULL)
                 return FALSE;
 
-        ssid = get_ssid_from_bss (bss);
+        get_ssid_from_bss (bss, ssid);
         g_debug ("WiFi AP '%s' removed.", ssid);
-        g_free (ssid);
 
         g_hash_table_remove (hash_table, path);
 
@@ -545,14 +550,18 @@
 {
         GClueWifiPrivate *priv = wifi->priv;
 
-        if (priv->bss_added_id == 0 || priv->interface == NULL)
-                return;
-
         cancel_wifi_scan (wifi);
-        g_signal_handler_disconnect (priv->interface, priv->bss_added_id);
-        priv->bss_added_id = 0;
-        g_signal_handler_disconnect (priv->interface, priv->bss_removed_id);
-        priv->bss_removed_id = 0;
+
+        if (priv->bss_added_id != 0) {
+                g_signal_handler_disconnect (priv->interface,
+                                             priv->bss_added_id);
+                priv->bss_added_id = 0;
+        }
+        if (priv->bss_removed_id != 0) {
+                g_signal_handler_disconnect (priv->interface,
+                                             priv->bss_removed_id);
+                priv->bss_removed_id = 0;
+        }
 
         g_hash_table_remove_all (priv->bss_proxies);
         g_hash_table_remove_all (priv->ignored_bss_proxies);
@@ -829,10 +838,13 @@
                          GError        **error)
 {
         GList *bss_list; /* As in Access Points */
+        SoupMessage *msg;
 
         bss_list = get_bss_list (GCLUE_WIFI (source), NULL);
 
-        return gclue_mozilla_create_query (bss_list, NULL, error);
+        msg = gclue_mozilla_create_query (bss_list, NULL, error);
+        g_list_free (bss_list);
+        return msg;
 }
 
 static GClueLocation *
@@ -849,13 +861,16 @@
                                 GError         **error)
 {
         GList *bss_list; /* As in Access Points */
+        SoupMessage * msg;
 
         bss_list = get_bss_list (GCLUE_WIFI (source), error);
         if (bss_list == NULL)
                 return NULL;
 
-        return gclue_mozilla_create_submit_query (location,
-                                                  bss_list,
-                                                  NULL,
-                                                  error);
+        msg = gclue_mozilla_create_submit_query (location,
+                                                 bss_list,
+                                                 NULL,
+                                                 error);
+        g_list_free (bss_list);
+        return msg;
 }
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to