54c882
diff -up vim80/src/regexp_nfa.c.cve3796-fix vim80/src/regexp_nfa.c
54c882
--- vim80/src/regexp_nfa.c.cve3796-fix	2021-09-20 08:27:13.752604505 +0200
54c882
+++ vim80/src/regexp_nfa.c	2021-09-20 08:29:10.206546910 +0200
54c882
@@ -5493,7 +5493,8 @@ find_match_text(colnr_T startcol, int re
54c882
 		match = FALSE;
54c882
 		break;
54c882
 	    }
54c882
-	    len2 += MB_CHAR2LEN(c2);
54c882
+	    len2 += enc_utf8 ? utf_ptr2len(regline + col + len2)
54c882
+							     : MB_CHAR2LEN(c2);
54c882
 	}
54c882
 	if (match
54c882
 #ifdef FEAT_MBYTE