kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=7a2769cad7181a4ecf844714d0c06a423156b739

commit 7a2769cad7181a4ecf844714d0c06a423156b739
Author: Kim Woelders <[email protected]>
Date:   Sat Nov 9 14:09:37 2019 +0100

    XPM loader: Accept signature not at the very start of the file
---
 src/modules/loaders/loader_xpm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/modules/loaders/loader_xpm.c b/src/modules/loaders/loader_xpm.c
index c18faa2..c35f32d 100644
--- a/src/modules/loaders/loader_xpm.c
+++ b/src/modules/loaders/loader_xpm.c
@@ -125,14 +125,15 @@ load(ImlibImage * im, ImlibProgressFunction progress, 
char progress_granularity,
    if (!f)
       return 0;
 
-   if (fread(s, 1, 9, f) != 9)
+   if (fread(s, 1, sizeof(s) - 1, f) < 9)
       goto quit;
 
-   rewind(f);
-   s[9] = 0;
-   if (strcmp("/* XPM */", s))
+   s[sizeof(s) - 1] = '\0';
+   if (!strstr(s, " XPM */"))
       goto quit;
 
+   rewind(f);
+
    i = 0;
    j = 0;
    w = 10;

-- 


Reply via email to