summaryrefslogtreecommitdiff
path: root/src/string
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-26 18:04:17 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-26 18:04:17 -0400
commit054ba185999d29f6ae9a8e19549da95f783655b6 (patch)
tree2df9c3ff8d0f1c79f171cba5a6542f6fe80908db /src/string
parent6436b371af2b52a7b60a5b4f304d1aca2f9f60b3 (diff)
downloadmusl-054ba185999d29f6ae9a8e19549da95f783655b6.tar.gz
musl-054ba185999d29f6ae9a8e19549da95f783655b6.tar.bz2
musl-054ba185999d29f6ae9a8e19549da95f783655b6.tar.xz
musl-054ba185999d29f6ae9a8e19549da95f783655b6.zip
fix overrun (n essentially ignored) in wcsncmp
bug report and solution by Richard Pennington
Diffstat (limited to 'src/string')
-rw-r--r--src/string/wcsncmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/wcsncmp.c b/src/string/wcsncmp.c
index 1b159f41..4ab32a92 100644
--- a/src/string/wcsncmp.c
+++ b/src/string/wcsncmp.c
@@ -2,6 +2,6 @@
int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n)
{
- for (; n && *l==*r && *l && *r; l++, r++);
+ for (; n && *l==*r && *l && *r; n--, l++, r++);
return n ? *l - *r : 0;
}