diff options
author | Dominique Pelle <dominique.pelle@gmail.com> | 2022-01-12 15:24:40 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-12 15:24:40 +0000 |
commit | f5d639a8af719eb8ecb141b5c0890627e4d83134 (patch) | |
tree | 2890e8ac277b77edd6cb76464a54ff30af478d3f /src/filepath.c | |
parent | 5d9826973d9f4c6ffbb5648676bb628660c62906 (diff) |
patch 8.2.4070: using uninitialized memory when reading empty filev8.2.4070
Problem: Using uninitialized memory when reading empty file.
Solution: Check for empty file before checking for NL. (Dominique Pellé,
closes #9511)
Diffstat (limited to 'src/filepath.c')
-rw-r--r-- | src/filepath.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/filepath.c b/src/filepath.c index eb5b8e0502..add74b4707 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1796,7 +1796,7 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) p < buf + readlen || (readlen <= 0 && (prevlen > 0 || binary)); ++p) { - if (*p == '\n' || readlen <= 0) + if (readlen <= 0 || *p == '\n') { listitem_T *li; char_u *s = NULL; |