diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2023-08-29 11:22:43 +0100 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2023-08-29 11:22:43 +0100 |
commit | ed03b1f3f69732a3718932474779fb61af3ae3b0 (patch) | |
tree | 05b9fec8d7048e69468746bfbbccebec3b55769b /gio/gresourcefile.c | |
parent | b35e70a7013120fbfba028ec5661f20c7c291178 (diff) |
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
Diffstat (limited to 'gio/gresourcefile.c')
-rw-r--r-- | gio/gresourcefile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gio/gresourcefile.c b/gio/gresourcefile.c index 488fa34e2..1621839cf 100644 --- a/gio/gresourcefile.c +++ b/gio/gresourcefile.c @@ -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); |