patch 9.1.1690: Missing recursion guard in dos/unix_expandpath()

Commit: 
https://github.com/vim/vim/commit/e8948a1f807cb595446e896e00bdf0e5339f0dd2
Author: ashamedbit <muralianirudd...@gmail.com>
Date:   Tue Aug 26 17:43:18 2025 +0200

    patch 9.1.1690: Missing recursion guard in dos/unix_expandpath()
    
    Problem:  Missing recursion guard in dos/unix_expandpath()
    Solution: Add guard variables (ashamedbit)
    
    fixes: #18099
    closes: #18106
    
    Co-authored-by: Hirohito Higashi <h.east....@gmail.com>
    Signed-off-by: ashamedbit <muralianirudd...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/filepath.c b/src/filepath.c
index 7d115eeda..d8a1dce74 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -3709,9 +3709,14 @@ dos_expandpath(
                vim_snprintf((char *)buf + len, buflen - len, "%s", path_end);
                if (mch_has_exp_wildcard(path_end))
                {
-                   // need to expand another component of the path
-                   // remove backslashes for the remaining components only
-                   (void)dos_expandpath(gap, buf, len + 1, flags, FALSE);
+                   if (stardepth < 100)
+                   {
+                       // need to expand another component of the path
+                       // remove backslashes for the remaining components only
+                       ++stardepth;
+                       (void)dos_expandpath(gap, buf, len + 1, flags, FALSE);
+                       --stardepth;
+                   }
                }
                else
                {
@@ -3950,9 +3955,14 @@ unix_expandpath(
                vim_snprintf((char *)buf + len, buflen - len, "%s", path_end);
                if (mch_has_exp_wildcard(path_end)) // handle more wildcards
                {
-                   // need to expand another component of the path
-                   // remove backslashes for the remaining components only
-                   (void)unix_expandpath(gap, buf, len + 1, flags, FALSE);
+                   if (stardepth < 100)
+                   {
+                       // need to expand another component of the path
+                       // remove backslashes for the remaining components only
+                       ++stardepth;
+                       (void)unix_expandpath(gap, buf, len + 1, flags, FALSE);
+                       --stardepth;
+                   }
                }
                else
                {
diff --git a/src/version.c b/src/version.c
index bedb8ec0b..b0ce4f311 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1690,
 /**/
     1689,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uqw5c-003XrW-Uo%40256bit.org.

Raspunde prin e-mail lui