mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0398: illegal memory access with "t"
Problem: Illegal memory access with "t".
Solution: Use strncmp() instead of memcmp(). (Dominique Pelle, closes vim/vim#1528)
66727e1607
This commit is contained in:
parent
9ddeb6e187
commit
63bb7198df
@ -1382,13 +1382,13 @@ int searchc(cmdarg_T *cap, int t_cmd)
|
|||||||
col -= (*mb_head_off)(p, p + col - 1) + 1;
|
col -= (*mb_head_off)(p, p + col - 1) + 1;
|
||||||
}
|
}
|
||||||
if (lastc_bytelen == 1) {
|
if (lastc_bytelen == 1) {
|
||||||
if (p[col] == c && stop)
|
if (p[col] == c && stop) {
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0 && stop)
|
} else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stop = TRUE;
|
stop = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
|
@ -298,3 +298,10 @@ func Test_searchpair()
|
|||||||
q!
|
q!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_searchc()
|
||||||
|
" These commands used to cause memory overflow in searchc().
|
||||||
|
new
|
||||||
|
norm ixx
|
||||||
|
exe "norm 0t\u93cf"
|
||||||
|
bw!
|
||||||
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user