Blame SOURCES/0001-patch-8.2.3669-buffer-overflow-with-long-help-argume.patch

39f0b7
diff --git a/src/help.c b/src/help.c
39f0b7
index ee6ff18..67e4fb2 100644
39f0b7
--- a/src/help.c
39f0b7
+++ b/src/help.c
39f0b7
@@ -422,8 +422,7 @@ find_help_tags(
39f0b7
 		    || (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
39f0b7
 							   && arg[2] != NUL)))
39f0b7
 	{
39f0b7
-	    STRCPY(d, "/\\\\");
39f0b7
-	    STRCPY(d + 3, arg + 1);
39f0b7
+	    vim_snprintf((char *)d, IOSIZE, "/\\\\%s", arg + 1);
39f0b7
 	    // Check for "/\\_$", should be "/\\_\$"
39f0b7
 	    if (d[3] == '_' && d[4] == '$')
39f0b7
 		STRCPY(d + 4, "\\$");
39f0b7
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
39f0b7
index ff2bc41..c8ff5b8 100644
39f0b7
--- a/src/testdir/test_help.vim
39f0b7
+++ b/src/testdir/test_help.vim
39f0b7
@@ -123,5 +123,13 @@ func Test_helptag_cmd_readonly()
39f0b7
   call delete('Xdir', 'rf')
39f0b7
 endfunc
39f0b7
 
39f0b7
+func Test_help_long_argument()
39f0b7
+  try
39f0b7
+    exe 'help \%' .. repeat('0', 1021)
39f0b7
+  catch
39f0b7
+    call assert_match("E149:", v:exception)
39f0b7
+  endtry
39f0b7
+endfunc
39f0b7
+
39f0b7
 
39f0b7
 " vim: shiftwidth=2 sts=2 expandtab