diff src/search.c @ 11018:654fc5636b37 v8.0.0398

patch 8.0.0398: illegal memory access with "t" commit https://github.com/vim/vim/commit/66727e16079fbac6db3897b5c3736ec9fba995bb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 1 22:17:05 2017 +0100 patch 8.0.0398: illegal memory access with "t" Problem: Illegal memory access with "t". Solution: Use strncmp() instead of memcmp(). (Dominique Pelle, closes https://github.com/vim/vim/issues/1528)
author Christian Brabandt <cb@256bit.org>
date Wed, 01 Mar 2017 22:30:04 +0100
parents 9b4574d95571
children e2258e86d8e1
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -1693,12 +1693,9 @@ searchc(cmdarg_T *cap, int t_cmd)
 		    if (p[col] == c && stop)
 			break;
 		}
-		else
-		{
-		    if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0
+		else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0
 								       && stop)
-			break;
-		}
+		    break;
 		stop = TRUE;
 	    }
 	}