aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-01-17 08:53:10 +0800
committerGitHub <noreply@github.com>2025-01-17 08:53:10 +0800
commitcd92924896ab6edeb4d3219befc59ac52a60bcf2 (patch)
treeca9778193c760cdde513cd8535c714bac7e9a87c /src
parent0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18 (diff)
downloadrneovim-cd92924896ab6edeb4d3219befc59ac52a60bcf2.tar.gz
rneovim-cd92924896ab6edeb4d3219befc59ac52a60bcf2.tar.bz2
rneovim-cd92924896ab6edeb4d3219befc59ac52a60bcf2.zip
vim-patch:9.1.1021: string might be used without a trailing NUL (#32062)
Problem: string might be used without a trailing NUL (after v9.1.0997) Solution: Make sure that the buffer is NUL terminated closes: vim/vim#16457 https://github.com/vim/vim/commit/70dfc374ec72634a0a61aea8344178779675d516 Co-authored-by: John Marriott <basilisk@internode.on.net>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/statusline.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index fe6892cc27..434d4c8a6f 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -103,7 +103,8 @@ void win_redr_status(win_T *wp)
|| bufIsChanged(wp->w_buffer)
|| wp->w_buffer->b_p_ro)
&& plen < MAXPATHL - 1) {
- *(p + plen++) = ' ';
+ *(p + plen++) = ' '; // replace NUL with space
+ *(p + plen) = NUL; // NUL terminate the string
}
if (bt_help(wp->w_buffer)) {
plen += snprintf(p + plen, MAXPATHL - (size_t)plen, "%s", _("[Help]"));