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)
diff --git a/src/filepath.c b/src/filepath.c
index eb5b8e0..add74b4 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1796,7 +1796,7 @@
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;