Mercurial > vim
comparison src/textobject.c @ 28802:1ab5add6f4e8 v8.2.4925
patch 8.2.4925: trailing backslash may cause reading past end of line
Commit: https://github.com/vim/vim/commit/53a70289c2712808e6d4e88927e03cac01b470dd
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 9 13:15:07 2022 +0100
patch 8.2.4925: trailing backslash may cause reading past end of line
Problem: Trailing backslash may cause reading past end of line.
Solution: Check for NUL after backslash.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 09 May 2022 14:30:03 +0200 |
parents | d4a710f06f02 |
children | 42e3dfd5b2d6 |
comparison
equal
deleted
inserted
replaced
28801:d5220df2d11b | 28802:1ab5add6f4e8 |
---|---|
1662 { | 1662 { |
1663 c = line[col]; | 1663 c = line[col]; |
1664 if (c == NUL) | 1664 if (c == NUL) |
1665 return -1; | 1665 return -1; |
1666 else if (escape != NULL && vim_strchr(escape, c)) | 1666 else if (escape != NULL && vim_strchr(escape, c)) |
1667 { | |
1667 ++col; | 1668 ++col; |
1669 if (line[col] == NUL) | |
1670 return -1; | |
1671 } | |
1668 else if (c == quotechar) | 1672 else if (c == quotechar) |
1669 break; | 1673 break; |
1670 if (has_mbyte) | 1674 if (has_mbyte) |
1671 col += (*mb_ptr2len)(line + col); | 1675 col += (*mb_ptr2len)(line + col); |
1672 else | 1676 else |