src/fccache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 710cae607f13cee09f158229ea5462221b8e02de Merge: ad0ce15 6ae9f71 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Fri Jul 19 09:21:36 2024 +0000 Merge branch 'softwarefailure-main-patch-06986' into 'main' Fix double slashes in path See merge request fontconfig/fontconfig!326 commit 6ae9f7134f67b12602a2270e45e70887550c406f Author: Andreas Falkenhahn <andreas@xxxxxxxxxxxxxx> Date: Sat Jul 6 16:34:09 2024 +0000 Do not prefix cache_base with a "/". Doing so will lead to FcStrBuildFilename() composing paths that contain double slashes, e.g. in FcDirCacheProcess(). If FcDirCacheBasenameMD5() returns a cache_base that is prefixed with a "/", the call to FcStrBuildFilename() in FcDirCacheProcess() will compose a path that contains double slashes and this double-slashed path will then be passed to FcDirCacheOpenFile(). This won't cause any harm on Linux because Linux just ignores multiple slashes in paths but on other operating systems multiple slashes in paths are not allowed so FcDirCacheOpenFile() will fail on those platforms because of the double slash in the path. diff --git a/src/fccache.c b/src/fccache.c index e0dc4c9..e74dada 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -194,8 +194,7 @@ FcDirCacheBasenameMD5 (FcConfig *config, const FcChar8 *dir, FcChar8 cache_base[ if (key) FcStrFree (key); - cache_base[0] = '/'; - hex_hash = cache_base + 1; + hex_hash = cache_base; for (cnt = 0; cnt < 16; ++cnt) { hex_hash[2*cnt ] = bin2hex[hash[cnt] >> 4];