diff src/ex_docmd.c @ 26960:043a15b37bf1 v8.2.4009

patch 8.2.4009: reading one byte beyond the end of the line Commit: https://github.com/vim/vim/commit/d3a117814d6acbf0dca3eff1a7626843b9b3734a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 5 16:50:40 2022 +0000 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Jan 2022 18:00:05 +0100
parents d92e0d85923f
children 85866e069c24
line wrap: on
line diff
--- 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;