musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/string/wcsstr.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014年04月18日 17:38:35 -0400
committerRich Felker <dalias@aerifal.cx>2014年04月18日 17:38:35 -0400
commit476cd1d96560aaf7f210319597556e7fbcd60469 (patch)
tree15d02708160ed765160ed8bec3885441eeba21c2 /src/string/wcsstr.c
parentfbeadd150feaa7993250d2d6739df670d4539e54 (diff)
downloadmusl-476cd1d96560aaf7f210319597556e7fbcd60469.tar.gz
fix false negatives with periodic needles in strstr, wcsstr, and memmem
in cases where the memorized match range from the right factor exceeded the length of the left factor, it was wrongly treated as a mismatch rather than a match. issue reported by Yves Bastide.
Diffstat (limited to 'src/string/wcsstr.c')
-rw-r--r--src/string/wcsstr.c 2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/wcsstr.c b/src/string/wcsstr.c
index 3e28e287..4caaef3c 100644
--- a/src/string/wcsstr.c
+++ b/src/string/wcsstr.c
@@ -84,7 +84,7 @@ static wchar_t *twoway_wcsstr(const wchar_t *h, const wchar_t *n)
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k == mem) return (wchar_t *)h;
+ if (k <= mem) return (wchar_t *)h;
h += p;
mem = mem0;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月14日 20:35:10 +0000

AltStyle によって変換されたページ (->オリジナル) /