Blame src/regression/wcsncpy-read-overflow.c
|
Szabolcs Nagy |
cfa23c |
// commit: e98136207ad1a6df1cdc1578e4ad56f8f0db4047 2011-05-22
|
|
Szabolcs Nagy |
cfa23c |
#include <wchar.h>
|
|
Szabolcs Nagy |
cfa23c |
#include "test.h"
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
int main(void)
|
|
Szabolcs Nagy |
cfa23c |
{
|
|
Szabolcs Nagy |
cfa23c |
wchar_t dst[] = { 'a', 'a' };
|
|
Szabolcs Nagy |
cfa23c |
wchar_t src[] = { 0, 'b' };
|
|
Szabolcs Nagy |
cfa23c |
|
|
Szabolcs Nagy |
cfa23c |
wcsncpy(dst, src, 1);
|
|
Szabolcs Nagy |
cfa23c |
if(dst[1] != 'a')
|
|
Szabolcs Nagy |
cfa23c |
t_error("wcsncpy copied more than N\n");
|
|
Szabolcs Nagy |
cfa23c |
return t_status;
|
|
Szabolcs Nagy |
cfa23c |
}
|