mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
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 #9511)
This commit is contained in:
committed by
Bram Moolenaar
parent
5d9826973d
commit
f5d639a8af
@@ -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;
|
||||
|
Reference in New Issue
Block a user