Mercurial > vim
changeset 26286:2815b25993fb v8.2.3674
patch 8.2.3674: when ml_get_buf() fails it messes up IObuff
Commit: https://github.com/vim/vim/commit/96e7a5928e1e7a350cd6c6d0b9376305190046e7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 25 13:52:37 2021 +0000
patch 8.2.3674: when ml_get_buf() fails it messes up IObuff
Problem: When ml_get_buf() fails it messes up IObuff.
Solution: Return a local pointer. (closes https://github.com/vim/vim/issues/9214)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Nov 2021 15:00:06 +0100 |
parents | 4bfa37787ac9 |
children | 6c01cf7bd288 |
files | src/memline.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/memline.c +++ b/src/memline.c @@ -2606,6 +2606,7 @@ ml_get_buf( bhdr_T *hp; DATA_BL *dp; static int recursive = 0; + static char_u questions[4]; if (lnum > buf->b_ml.ml_line_count) // invalid line number { @@ -2618,9 +2619,9 @@ ml_get_buf( --recursive; } errorret: - STRCPY(IObuff, "???"); + STRCPY(questions, "???"); buf->b_ml.ml_line_len = 4; - return IObuff; + return questions; } if (lnum <= 0) // pretend line 0 is line 1 lnum = 1;