提交 054ba185 编写于 作者: R Rich Felker

fix overrun (n essentially ignored) in wcsncmp

bug report and solution by Richard Pennington
上级 6436b371
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n) 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; return n ? *l - *r : 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册