commit cd92924896ab6edeb4d3219befc59ac52a60bcf2
parent 0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 17 Jan 2025 08:53:10 +0800
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:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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]"));