This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 581de800b4a8a89f6f3f5c361c44e307c469f8b9
Author: NRK <[email protected]>
AuthorDate: Wed Jun 29 03:43:59 2022 +0600

    modules: check for filepath truncation
    
    also check for (unlikely) snprintf error.
---
 src/lib/modules.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lib/modules.c b/src/lib/modules.c
index d6dfb3f..2833c86 100644
--- a/src/lib/modules.c
+++ b/src/lib/modules.c
@@ -159,6 +159,7 @@ __imlib_ModulesList(char **ppath, int *num_ret)
 char               *
 __imlib_ModuleFind(char **ppath, const char *name)
 {
+   int                 n;
    char              **pp;
    char                nbuf[4096];
 
@@ -167,9 +168,9 @@ __imlib_ModuleFind(char **ppath, const char *name)
 
    for (pp = ppath; *pp; pp++)
      {
-        snprintf(nbuf, sizeof(nbuf), "%s/%s.so", *pp, name);
+        n = snprintf(nbuf, sizeof(nbuf), "%s/%s.so", *pp, name);
 
-        if (!__imlib_FileIsFile(nbuf))
+        if (n < 0 || n >= sizeof(nbuf) || !__imlib_FileIsFile(nbuf))
            continue;
 
         return strdup(nbuf);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to