Module: kamailio Branch: master Commit: 2ba6d4ff2727031e7bca5d3d1da016bfe508b8df URL: https://github.com/kamailio/kamailio/commit/2ba6d4ff2727031e7bca5d3d1da016bf...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@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/2ba6d4ff2727031e7bca5d3d1da016bf... Patch: https://github.com/kamailio/kamailio/commit/2ba6d4ff2727031e7bca5d3d1da016bf...
---
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; }