diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-25 20:45:16 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-25 20:45:16 +0000 |
commit | 806d037671e133bd28a7864248763f643967973a (patch) | |
tree | 64269f1fedb4fffa3f09da8e79e2db78238566ff /src/edit.c | |
parent | 8d02ce1ed75d008c34a5c9aaa51b67cbb9d33baa (diff) |
patch 8.2.4218: illegal memory access with bracketed paste in Ex modev8.2.4218
Problem: Illegal memory access with bracketed paste in Ex mode.
Solution: Reserve space for the trailing NUL.
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c index ee3caf0dad..2b5301100d 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4452,7 +4452,8 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap) break; case PASTE_EX: - if (gap != NULL && ga_grow(gap, idx) == OK) + // add one for the NUL that is going to be appended + if (gap != NULL && ga_grow(gap, idx + 1) == OK) { mch_memmove((char *)gap->ga_data + gap->ga_len, buf, (size_t)idx); |