patch 9.1.1292: statusline not correctly evaluated

Commit: 
https://github.com/vim/vim/commit/c8ce81b0dcaddefc65e3d445c92c9e0253bd9173
Author: Hirohito Higashi <h.east....@gmail.com>
Date:   Sat Apr 12 11:28:18 2025 +0200

    patch 9.1.1292: statusline not correctly evaluated
    
    Problem:  statusline not correctly evaluated
              (Peter Kenny, after v9.1.1291)
    Solution: revert part of patch v9.1.1291
              (Hirohito Higashi)
    
    fixes: #17095
    closes: #17094
    
    Signed-off-by: Hirohito Higashi <h.east....@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/buffer.c b/src/buffer.c
index 955800e3a..eed3e8de1 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4834,14 +4834,25 @@ build_stl_str_hl(
                    && evaldepth < MAX_STL_EVAL_DEPTH)
            {
                size_t parsed_usefmt = (size_t)(block_start - usefmt);
-               size_t new_fmt_len = (parsed_usefmt
-                       + STRLEN(str) + STRLEN(s) + 3) * sizeof(char_u);
-               char_u *new_fmt = (char_u *)alloc(new_fmt_len);
+               size_t str_length = strlen((const char *)str);
+               size_t fmt_length = strlen((const char *)s);
+               size_t new_fmt_len = parsed_usefmt
+                                                + str_length + fmt_length + 3;
+               char_u *new_fmt = (char_u *)alloc(new_fmt_len * sizeof(char_u));
 
                if (new_fmt != NULL)
                {
-                   vim_snprintf((char *)new_fmt, new_fmt_len, "%.*s%s%s%s",
-                       (int)parsed_usefmt, usefmt, str, "%}", s);
+                   char_u *new_fmt_p = new_fmt;
+
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p, usefmt, 
parsed_usefmt)
+                                                                  + 
parsed_usefmt;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p , str, str_length)
+                                                                     + 
str_length;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p, "%}", 2) + 2;
+                   new_fmt_p = (char_u *)memcpy(new_fmt_p , s, fmt_length)
+                                                                     + 
fmt_length;
+                   *new_fmt_p = 0;
+                   new_fmt_p = NULL;
 
                    if (usefmt != fmt)
                        vim_free(usefmt);
diff --git a/src/version.c b/src/version.c
index e500aa19e..1b1cfd6b3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1292,
 /**/
     1291,
 /**/

-- 
-- 
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/E1u3XQ7-00Fov5-SI%40256bit.org.

Raspunde prin e-mail lui