mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 23:31:51 +00:00
vim-patch:8.2.4070: using uninitialized memory when reading empty file
Problem: Using uninitialized memory when reading empty file.
Solution: Check for empty file before checking for NL. (Dominique Pellé,
closes vim/vim#9511)
f5d639a8af
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
This commit is contained in:
@@ -5921,7 +5921,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
for (p = buf, start = buf;
|
||||
p < buf + readlen || (readlen <= 0 && (prevlen > 0 || binary));
|
||||
p++) {
|
||||
if (*p == '\n' || readlen <= 0) {
|
||||
if (readlen <= 0 || *p == '\n') {
|
||||
char *s = NULL;
|
||||
size_t len = (size_t)(p - start);
|
||||
|
||||
|
Reference in New Issue
Block a user