fix(ops): str_to_reg passing NULL to memcpy

Required for the tests introduced in v8.2.3601 to pass ASAN when running
test_alot.vim.

Co-authored-by: erw7 <erw7.github@gmail.com>
This commit is contained in:
Sean Dewar
2022-02-17 01:43:18 +00:00
parent 308c1952aa
commit 8170260bb3

View File

@@ -5696,7 +5696,9 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str
// When appending, copy the previous line and free it after. // When appending, copy the previous line and free it after.
size_t extra = append ? STRLEN(pp[--lnum]) : 0; size_t extra = append ? STRLEN(pp[--lnum]) : 0;
char_u *s = xmallocz(line_len + extra); char_u *s = xmallocz(line_len + extra);
if (extra > 0) {
memcpy(s, pp[lnum], extra); memcpy(s, pp[lnum], extra);
}
memcpy(s + extra, start, line_len); memcpy(s + extra, start, line_len);
size_t s_len = extra + line_len; size_t s_len = extra + line_len;