vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / string / strncmp.c
blob43ca5a5d92a18eea220d2a7c09884c3b3b402c4f
1 /*
2 * Copyright 2008, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT license.
4 */
7 #include <string.h>
10 int
11 strncmp(char const *a, char const *b, size_t count)
13 while (count-- > 0) {
14 int cmp = (unsigned char)*a - (unsigned char)*b++;
15 if (cmp != 0 || *a++ == '\0')
16 return cmp;
19 return 0;