vfs: check userland buffers before reading them.
[haiku.git] / src / tests / system / libroot / posix / tst-wcstof.c
blob2f0c770627771b4006182800f5507173bd8c7e43
1 #define _GNU_SOURCE 1
2 #include <wchar.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <wctype.h>
8 int
9 main(void)
11 int result = 0;
12 char buf[100];
13 wchar_t tmp[3];
14 tmp[0] = '8';
15 tmp[1] = '1';
16 tmp[2] = 0;
18 snprintf(buf, 100, "%S = %f", tmp, wcstof(tmp, NULL));
19 printf("\"%s\" -> %s\n", buf, strcmp(buf, "81 = 81.000000") == 0 ? "okay"
20 : "buggy");
21 result |= strcmp(buf, "81 = 81.000000") != 0;
23 return result;