mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-05 23:48:44 +02:00
gresourcefile: Fix crash if called with a badly escaped URI
Return an invalid `GFile` instead, as is the custom for VFS functions. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk> Fixes: #3090
This commit is contained in:
@@ -238,6 +238,7 @@ g_resource_file_new_for_path (const char *path)
|
||||
return G_FILE (resource);
|
||||
}
|
||||
|
||||
/* Will return %NULL if @uri is malformed */
|
||||
GFile *
|
||||
_g_resource_file_new (const char *uri)
|
||||
{
|
||||
@@ -245,6 +246,9 @@ _g_resource_file_new (const char *uri)
|
||||
char *path;
|
||||
|
||||
path = g_uri_unescape_string (uri + strlen ("resource:"), NULL);
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
|
||||
resource = g_resource_file_new_for_path (path);
|
||||
g_free (path);
|
||||
|
||||
|
Reference in New Issue
Block a user