[goffice] Make go_doc_image_fetch more secure.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Make go_doc_image_fetch more secure.
- Date: Fri, 5 Jul 2013 13:53:33 +0000 (UTC)
commit 9e78b87a7df2516fb4171c8c8fdfbde4dbe4a2c9
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Jul 5 15:51:21 2013 +0200
Make go_doc_image_fetch more secure.
ChangeLog | 4 ++++
goffice/app/go-doc.c | 7 +++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ba11229..2a5279d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-05 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/app/go-doc.c (go_doc_image_fetch): make it more secure.
+
2013-06-25 Morten Welinder <terra gnome org>
* configure.ac: Post-release bump.
diff --git a/goffice/app/go-doc.c b/goffice/app/go-doc.c
index 601dec8..c7161c4 100644
--- a/goffice/app/go-doc.c
+++ b/goffice/app/go-doc.c
@@ -673,7 +673,14 @@ go_doc_image_fetch (GODoc *doc, char const *id, GType type)
g_return_val_if_fail (doc && doc->priv->imagebuf, NULL);
image = g_hash_table_lookup (doc->priv->imagebuf, id);
if (!image) {
+ g_return_val_if_fail (type != 0, NULL);
image = g_object_new (type, NULL);
+ if (!GO_IS_IMAGE (image)) {
+ if (image)
+ g_object_unref (image);
+ g_critical ("Invalid image type");
+ return NULL;
+ }
go_image_set_name (image, id);
g_hash_table_replace (doc->priv->imagebuf,
g_strdup (go_image_get_name (image)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]