From: Rich Felker Date: Sat, 26 May 2012 22:04:17 +0000 (-0400) Subject: fix overrun (n essentially ignored) in wcsncmp X-Git-Tag: v0.9.1~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=054ba185999d29f6ae9a8e19549da95f783655b6;p=oweals%2Fmusl.git fix overrun (n essentially ignored) in wcsncmp bug report and solution by Richard Pennington --- 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; }