Blame src/regression/mbsrtowcs-overflow.c
|
Szabolcs Nagy |
30874a |
|
|
Szabolcs Nagy |
30874a |
|
|
Szabolcs Nagy |
30874a |
#include <wchar.h>
|
|
Szabolcs Nagy |
30874a |
#include "test.h"
|
|
Szabolcs Nagy |
30874a |
|
|
Szabolcs Nagy |
30874a |
int main(void)
|
|
Szabolcs Nagy |
30874a |
{
|
|
Szabolcs Nagy |
30874a |
wchar_t ws[] = L"XXXXX";
|
|
Szabolcs Nagy |
30874a |
const char *src = "abcd";
|
|
Szabolcs Nagy |
30874a |
const char *want = src + 4;
|
|
Szabolcs Nagy |
30874a |
size_t r;
|
|
Szabolcs Nagy |
30874a |
|
|
Szabolcs Nagy |
30874a |
r = mbsrtowcs(ws, &src, 4, 0);
|
|
Szabolcs Nagy |
30874a |
if (r != 4)
|
|
Szabolcs Nagy |
30874a |
t_error("mbsrtowcs(ws, &abcd, 4, 0) returned %zu, wanted 4\n", r);
|
|
Szabolcs Nagy |
30874a |
if (src != want)
|
|
Szabolcs Nagy |
30874a |
t_error("mbsrtowcs(ws, &abcd, 4, 0) set abcd to %p wanted %p\n", src, want);
|
|
Szabolcs Nagy |
30874a |
if (wcscmp(ws, L"abcdX") != 0)
|
|
Szabolcs Nagy |
30874a |
t_error("ws is L\"%ls\", wanted L\"abcdX\"\n", ws);
|
|
Szabolcs Nagy |
30874a |
|
|
Szabolcs Nagy |
30874a |
return t_status;
|
|
Szabolcs Nagy |
30874a |
}
|