mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
Finding only valid UTF-8 byte sequences when searching.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5316 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
f47813eefa
commit
b967368d41
@ -2,6 +2,8 @@
|
||||
* doc/man/{nano.1,nanorc.5}, doc/texinfo/nano.texi: Add deprecation
|
||||
notices for the options 'set const', 'set poslog' and '--poslog'.
|
||||
Suggested by Eitan Adler.
|
||||
* src/chars.c (mbstrcasestr, mbrevstrcasestr): When searching, find
|
||||
only valid UTF-8 byte sequences. This fixes Savannah bug #45579.
|
||||
|
||||
2015-07-22 Mike Frysinger <vapier@gentoo.org>
|
||||
* src/files.c (check_dotnano), src/global.c (thanks_for_all_the_fish),
|
||||
|
@ -636,7 +636,8 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
|
||||
for (; *haystack != '\0' && haystack_len >= needle_len;
|
||||
haystack += move_mbright(haystack, 0), haystack_len--) {
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0 &&
|
||||
mblen(haystack, MB_CUR_MAX) > 0)
|
||||
return (char *)haystack;
|
||||
}
|
||||
|
||||
@ -729,8 +730,9 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||
rev_start_len = mbstrlen(rev_start);
|
||||
|
||||
while (!begin_line) {
|
||||
if (rev_start_len >= needle_len && mbstrncasecmp(rev_start,
|
||||
needle, needle_len) == 0)
|
||||
if (rev_start_len >= needle_len &&
|
||||
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
|
||||
mblen(rev_start, MB_CUR_MAX) > 0)
|
||||
return (char *)rev_start;
|
||||
|
||||
if (rev_start == haystack)
|
||||
|
Loading…
Reference in New Issue
Block a user