From bd58857201452aba99d78742990296f1a6b72c6a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 20 Jul 2026 17:34:20 +0200 Subject: [PATCH] vtls_scache: allocate absolute filename on heap (Windows) To allow any full path lengths, beyond the 260 characters allowed by `_MAX_PATH`. Follow-up to fa0ccd9f1fbbbd77bf50b26e3ba231ea6c729474 #15774 Closes #22357 --- lib/vtls/vtls_scache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index c7e1cdb46c..7148bf3297 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -76,9 +76,13 @@ static CURLcode cf_ssl_peer_key_add_path(struct dynbuf *buf, * when used in another process with different CWD. When a path does not * exist, this does not work. Then, we add the path as is. */ #ifdef _WIN32 - char abspath[_MAX_PATH]; - if(_fullpath(abspath, path, _MAX_PATH)) - return curlx_dyn_addf(buf, ":%s-%s", name, abspath); + char *abspath = _fullpath(NULL, path, 0); + if(abspath) { + CURLcode result = curlx_dyn_addf(buf, ":%s-%s", name, abspath); + /* !checksrc! disable BANNEDFUNC 1 */ + free(abspath); /* allocated by CRT, use system free() */ + return result; + } *is_local = TRUE; #elif defined(HAVE_REALPATH) if(path[0] != '/') {