From 8125e62dc44f126ae273526667ac290d96e63c9b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 14 Nov 2003 23:28:01 +0000 Subject: Check that the mask is NULL or a string of the same length consisting Sat Nov 15 00:26:19 2003 Matthias Clasen * queryloaders.c (loader_sanity_check): Check that the mask is NULL or a string of the same length consisting entirely of ' ', '!', 'x', 'z', 'n'. --- gdk-pixbuf/queryloaders.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'gdk-pixbuf/queryloaders.c') diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c index 0e1502a44..41c4c3669 100644 --- a/gdk-pixbuf/queryloaders.c +++ b/gdk-pixbuf/queryloaders.c @@ -59,13 +59,32 @@ loader_sanity_check (const char *path, GdkPixbufFormat *info, GdkPixbufModule *v const GdkPixbufModulePattern *pattern; const char *error = ""; - for (pattern = info->signature; pattern->prefix; pattern++) - if (strlen (pattern->prefix) == 0) + for (pattern = info->signature; pattern->prefix; pattern++) + { + int prefix_len = strlen (pattern->prefix); + if (prefix_len == 0) { error = "empty pattern"; goto error; } + if (pattern->mask) + { + int mask_len = strlen (pattern->mask); + if (mask_len != prefix_len) + { + error = "mask length mismatch"; + + goto error; + } + if (strspn (pattern->mask, " !xzn") < mask_len) + { + error = "bad char in mask"; + + goto error; + } + } + } if (!vtable->load && !vtable->begin_load && !vtable->load_animation) { -- cgit v1.2.1