From a2e869cb700c13804056820fd4afa215e551b9c5 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 26 Jan 2012 21:17:31 +0100 Subject: Add permission check before loading other files Wrap _rsvg_io_acquire_* in _rsvg_handle_acquire_* that first checks whether the load should be allowed. For the moment, always allow the load; more restricted policies will be introduced in a follow-up commit. --- rsvg-defs.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'rsvg-defs.c') diff --git a/rsvg-defs.c b/rsvg-defs.c index 0c3df9f9..71678d7e 100644 --- a/rsvg-defs.c +++ b/rsvg-defs.c @@ -36,8 +36,8 @@ struct _RsvgDefs { GHashTable *hash; GPtrArray *unnamed; GHashTable *externs; - gchar *base_uri; GSList *toresolve; + RsvgHandle *ctx; }; typedef struct _RsvgResolutionPending RsvgResolutionPending; @@ -48,7 +48,7 @@ struct _RsvgResolutionPending { }; RsvgDefs * -rsvg_defs_new (void) +rsvg_defs_new (RsvgHandle *handle) { RsvgDefs *result = g_new (RsvgDefs, 1); @@ -56,18 +56,12 @@ rsvg_defs_new (void) result->externs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_object_unref); result->unnamed = g_ptr_array_new (); - result->base_uri = NULL; result->toresolve = NULL; + result->ctx = handle; /* no need to take a ref here */ return result; } -void -rsvg_defs_set_base_uri (RsvgDefs * self, gchar * base_uri) -{ - self->base_uri = base_uri; -} - static int rsvg_defs_load_extern (const RsvgDefs * defs, const char *name) { @@ -76,9 +70,9 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name) guint8 *data; gsize data_len; - filename = rsvg_get_file_path (name, defs->base_uri); + filename = rsvg_get_file_path (name, rsvg_handle_get_base_uri (defs->ctx)); - data = _rsvg_io_acquire_data (name, defs->base_uri, &data_len, NULL); + data = _rsvg_handle_acquire_data (defs->ctx, name, &data_len, NULL); if (data) { handle = rsvg_handle_new (); -- cgit v1.2.1