summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-xpm.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-03-03 14:02:59 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-03-03 14:02:59 +0000
commit8acd054a0c041b770bbe661205fe69d421f530f8 (patch)
treeea97e2d58114084a52f7c0a90fa0c516142a63e7 /gdk-pixbuf/io-xpm.c
parent22634bd38802dc54c64988ef4dfd121f902fce69 (diff)
downloadgdk-pixbuf-8acd054a0c041b770bbe661205fe69d421f530f8.tar.gz
Check the number of scanned items. (#168906, Morten Welinder)
2005-03-03 Matthias Clasen <mclasen@redhat.com> * io-xpm.c (pixbuf_create_from_xpm): Check the number of scanned items. (#168906, Morten Welinder)
Diffstat (limited to 'gdk-pixbuf/io-xpm.c')
-rw-r--r--gdk-pixbuf/io-xpm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index 2125b9c45..45a7cae46 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -1230,6 +1230,15 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
return NULL;
}
items = sscanf (buffer, "%d %d %d %d %d %d", &w, &h, &n_col, &cpp, &x_hot, &y_hot);
+
+ if (items != 4 && items != 6) {
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Invalid XPM header"));
+ return NULL;
+ }
+
if (w <= 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,