patch 8.2.4009: reading one byte beyond the end of the line
Problem: Reading one byte beyond the end of the line.
Solution: Check for NUL byte first.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 41cbd30..1f15bc8 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3632,7 +3632,8 @@
}
// Check for "++nr" and "--nr".
- if (p == eap->cmd && p[0] == p[1] && (*p == '+' || *p == '-'))
+ if (p == eap->cmd && p[0] != NUL && p[0] == p[1]
+ && (*p == '+' || *p == '-'))
{
eap->cmdidx = *p == '+' ? CMD_increment : CMD_decrement;
return eap->cmd + 2;