Skip to content

Commit

Permalink
Add NULL checks to prevent crash on malformed bookmark URI (Issue #716)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schwinn committed Jan 29, 2022
1 parent b8cf11f commit 5962492
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion thunar/thunar-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions thunar/thunar-gio-extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 5962492

Please sign in to comment.