• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão6a7d94628b5a6388ced039eed2b566d624cf0656 (tree)
Hora2022-05-18 02:00:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.4974: ":so" command may read after end of buffer

Commit: https://github.com/vim/vim/commit/4748c4bd64610cf943a431d215bb1aad51f8d0b4
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 17 17:47:07 2022 +0100

patch 8.2.4974: ":so" command may read after end of buffer
Problem: ":so" command may read after end of buffer.
Solution: Compute length of text properly.

Mudança Sumário

Diff

diff -r 26d0d6f9b368 -r 6a7d94628b5a src/scriptfile.c
--- a/src/scriptfile.c Tue May 17 17:15:05 2022 +0200
+++ b/src/scriptfile.c Tue May 17 19:00:03 2022 +0200
@@ -1965,6 +1965,7 @@
19651965 break;
19661966 buf = (char_u *)ga.ga_data;
19671967 buf[ga.ga_len++] = NUL;
1968+ len = ga.ga_len;
19681969 }
19691970 else
19701971 {
@@ -1972,8 +1973,8 @@
19721973 if (fgets((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len,
19731974 sp->fp) == NULL)
19741975 break;
1976+ len = ga.ga_len + (int)STRLEN(buf + ga.ga_len);
19751977 }
1976- len = ga.ga_len + (int)STRLEN(buf + ga.ga_len);
19771978 #ifdef USE_CRNL
19781979 // Ignore a trailing CTRL-Z, when in Dos mode. Only recognize the
19791980 // CTRL-Z by its own, or after a NL.
diff -r 26d0d6f9b368 -r 6a7d94628b5a src/testdir/test_source.vim
--- a/src/testdir/test_source.vim Tue May 17 17:15:05 2022 +0200
+++ b/src/testdir/test_source.vim Tue May 17 19:00:03 2022 +0200
@@ -652,6 +652,17 @@
652652 norm300gr0
653653 so
654654 bwipe!
655+
656+ let lines =<< trim END
657+ new
658+ norm 10a0000000000ø00000000000
659+ norm i0000000000000000000
660+ silent! so
661+ END
662+ call writefile(lines, 'Xtest.vim')
663+ source Xtest.vim
664+ bwipe!
665+ call delete('Xtest.vim')
655666 endfunc
656667
657668
diff -r 26d0d6f9b368 -r 6a7d94628b5a src/version.c
--- a/src/version.c Tue May 17 17:15:05 2022 +0200
+++ b/src/version.c Tue May 17 19:00:03 2022 +0200
@@ -747,6 +747,8 @@
747747 static int included_patches[] =
748748 { /* Add new patch number below this line */
749749 /**/
750+ 4974,
751+/**/
750752 4973,
751753 /**/
752754 4972,
Show on old repository browser