vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / string / strxfrm.cpp
blob058f3cf12320d1898d857e5d6b9729d51b9da551
1 /*
2 * Copyright 2005, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3 * Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
4 * All rights reserved. Distributed under the terms of the MIT license.
5 */
7 #include <errno.h>
8 #include <string.h>
10 #include <errno_private.h>
11 #include "LocaleBackend.h"
14 using BPrivate::Libroot::gLocaleBackend;
17 extern "C" size_t
18 strxfrm(char *out, const char *in, size_t size)
20 if (gLocaleBackend != NULL) {
21 size_t outSize = 0;
22 status_t status = gLocaleBackend->Strxfrm(out, in, size, outSize);
24 if (status != B_OK)
25 __set_errno(EINVAL);
27 return outSize;
30 return strlcpy(out, in, size);