Module: kamailio
Branch: master
Commit: 2ba6d4ff2727031e7bca5d3d1da016bfe508b8df
URL: 
https://github.com/kamailio/kamailio/commit/2ba6d4ff2727031e7bca5d3d1da016bfe508b8df

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-11T12:41:26+01:00

core: check for unexpected long value return by pathconf()

---

Modified: src/core/ut.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/2ba6d4ff2727031e7bca5d3d1da016bfe508b8df.diff
Patch: 
https://github.com/kamailio/kamailio/commit/2ba6d4ff2727031e7bca5d3d1da016bfe508b8df.patch

---

diff --git a/src/core/ut.h b/src/core/ut.h
index f1829f73ca0..3a3d66202b6 100644
--- a/src/core/ut.h
+++ b/src/core/ut.h
@@ -546,7 +546,8 @@ inline static int pathmax(void)
 #endif
        if(pathmax == 0) { /* init */
                pathmax = pathconf("/", _PC_PATH_MAX);
-               pathmax = (pathmax <= 0) ? PATH_MAX_GUESS : pathmax + 1;
+               pathmax = (pathmax <= 0 || pathmax >= INT_MAX - 1) ? 
PATH_MAX_GUESS
+                                                                               
                                   : pathmax + 1;
        }
        return pathmax;
 }

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to