summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-05 16:50:40 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-05 16:50:40 +0000
commitd3a117814d6acbf0dca3eff1a7626843b9b3734a (patch)
tree0073cd30b677362a3936829903068b3400cdf511 /src/ex_docmd.c
parent677658ae49de31fe2e5b1fa6d93fdfab85a4362e (diff)
patch 8.2.4009: reading one byte beyond the end of the linev8.2.4009
Problem: Reading one byte beyond the end of the line. Solution: Check for NUL byte first.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 41cbd3090f..1f15bc8544 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3632,7 +3632,8 @@ find_ex_command(
}
// 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;