summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2023-01-06 08:23:37 +0100
committerOndrej Holy <oholy@redhat.com>2023-01-06 10:20:51 +0000
commit96619a12418db95d80bb5009c925af267bb37096 (patch)
treed64a8e6df1fe7cf70b014dc975f3e06fb46ee967
parent1c3d8dba2c661c67275dcc34febc6266972ba80f (diff)
downloadgvfs-96619a12418db95d80bb5009c925af267bb37096.tar.gz
dav: Prevent usage of NULL when user is not specified
When the username is not part of an URI, then the following message is printed: `GVFS-CRITICAL **: 12:31:47.663: g_mount_spec_set_with_len_internal: assertion 'value != NULL' failed`. This is because `g_mount_spec_set` is called with `NULL`. It possibly lead to crash when it is build with the `G_DISABLE_CHECKS` option. This bug was introduced recently by the commit 6636d89f. Let's check the value before setting it to fix this. Related: https://gitlab.gnome.org/GNOME/gvfs/-/issues/644
-rw-r--r--daemon/gvfsbackenddav.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index eee474ec..e70c9daf 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -2046,6 +2046,7 @@ mount_success (GVfsBackend *backend, GVfsJobMount *job)
GVfsBackendHttp *http_backend = G_VFS_BACKEND_HTTP (backend);
GMountSpec *mount_spec;
GUri *tmp;
+ const gchar *user;
/* Save the auth info in the keyring */
keyring_save_authinfo (&(dav_backend->auth_info.server_auth), http_backend->mount_base, FALSE);
@@ -2067,8 +2068,9 @@ mount_success (GVfsBackend *backend, GVfsJobMount *job)
* So it has to be restored here in order to avoid:
* https://gitlab.gnome.org/GNOME/gvfs/-/issues/614
*/
- g_mount_spec_set (mount_spec, "user",
- g_mount_spec_get (job->mount_spec, "user"));
+ user = g_mount_spec_get (job->mount_spec, "user");
+ if (user != NULL)
+ g_mount_spec_set (mount_spec, "user", user);
g_vfs_backend_set_mount_spec (backend, mount_spec);
g_vfs_backend_set_icon_name (backend, "folder-remote");