vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / wchar / wcscmp.c
blob471f19393b4d6314f1f3e0595adead80eb1d2bdd
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
6 #include <wchar_private.h>
9 int
10 __wcscmp(const wchar_t* wcs1, const wchar_t* wcs2)
12 int cmp;
14 for (;;) {
15 cmp = *wcs1 - *wcs2++;
16 /* note: won't overflow, since our wchar_t is guaranteed to never
17 have the highest bit set */
19 if (cmp != 0 || *wcs1++ == L'\0')
20 break;
23 return cmp;
27 B_DEFINE_WEAK_ALIAS(__wcscmp, wcscmp);