summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorcvs2svn Import User <samba-bugs@samba.org>2003-03-18 07:09:24 +0000
committercvs2svn Import User <samba-bugs@samba.org>2003-03-18 07:09:24 +0000
commit74d3be021897d47e04a4ebecc484d16621b93c9d (patch)
treeb6551b8c36820b2d5c9d24c4531dd0f14dc7ed97 /source3/torture
parent417bf608f4253fadf4b227b5f7360f03b0193ff2 (diff)
parenta084f06fe33eb9903489763bc34c7092080a0a5e (diff)
downloadsamba-74d3be021897d47e04a4ebecc484d16621b93c9d.tar.gz
samba-74d3be021897d47e04a4ebecc484d16621b93c9d.tar.bz2
samba-74d3be021897d47e04a4ebecc484d16621b93c9d.zip
This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to be commit f0d009c3e91979b0dc3443e16f3f545bcc64cfda)
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/t_stringoverflow.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/torture/t_stringoverflow.c b/source3/torture/t_stringoverflow.c
new file mode 100644
index 0000000000..ec14d81189
--- /dev/null
+++ b/source3/torture/t_stringoverflow.c
@@ -0,0 +1,23 @@
+#include "includes.h"
+
+ int main(void)
+{
+ fstring dest;
+ 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 */
+
+ pstrcpy(ptr, "hello!");
+
+ return 0;
+}