diff options
author | Alexander Schwinn <alexxcons@xfce.org> | 2022-01-19 22:53:21 +0100 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2022-01-29 22:07:45 +0100 |
commit | 596249266db2fa2bee66ca0b0eef443b080738d7 (patch) | |
tree | 2b8e99dc30d4ca3f70eb48ec78d43951109c1743 | |
parent | b8cf11fb428ec38a03f8dd4bf416da992d6a22cb (diff) | |
download | thunar-596249266db2fa2bee66ca0b0eef443b080738d7.tar.gz |
Add NULL checks to prevent crash on malformed bookmark URI (Issue #716)
-rw-r--r-- | thunar/thunar-file.c | 2 | ||||
-rw-r--r-- | thunar/thunar-gio-extensions.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index fbe7f864..100a4d3e 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -1005,7 +1005,7 @@ thunar_file_info_reload (ThunarFile *file, _thunar_assert (file->basename != NULL); /* problematic files with content type reading */ - if (strcmp (file->basename, "kmsg") == 0 + if (g_strcmp0 (file->basename, "kmsg") == 0 && g_file_is_native (file->gfile)) { path = g_file_get_path (file->gfile); diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c index 0544593e..b6bf589e 100644 --- a/thunar/thunar-gio-extensions.c +++ b/thunar/thunar-gio-extensions.c @@ -327,7 +327,7 @@ thunar_g_file_get_display_name_remote (GFile *mount_point) scheme = g_file_get_uri_scheme (mount_point); parse_name = g_file_get_parse_name (mount_point); - if (g_str_has_prefix (parse_name, scheme)) + if (scheme != NULL && g_str_has_prefix (parse_name, scheme)) { /* extract the hostname */ p = parse_name + strlen (scheme); @@ -372,7 +372,8 @@ thunar_g_file_get_display_name_remote (GFile *mount_point) g_free (hostname); } - g_free (scheme); + if (scheme != NULL) + g_free (scheme); g_free (parse_name); } |