summaryrefslogtreecommitdiffstats
path: root/source3/torture/t_stringoverflow.c
blob: 17765e6a2ce585da812388da0c5147e7d4fd4552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "includes.h"

 int main(void)
{
	char dest[100];
	char *ptr = dest;

	printf("running on valgrind? %d\n", RUNNING_ON_VALGRIND);

	/* Try copying a string into an fstring buffer.  The string
	 * will actually fit, but this is still wrong because you
	 * can't pstrcpy into an fstring.  This should trap in a
	 * developer build. */

#if 0
	/* As of CVS 20030318, this will be trapped at compile time! */
	pstrcpy(dest, "hello");
#endif /* 0 */

	fstrcpy(ptr, "hello!");

	return 0;
}