summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2003-03-12 02:57:48 +0000
committerMartin Pool <mbp@samba.org>2003-03-12 02:57:48 +0000
commitdcf1705782f5d589120624c90b695b81a0332e6b (patch)
treef174a92d0a36609afdb9b6588d740b786a6c15fe
parent01727b0296ee407e49444b9d9c4e7993892cb537 (diff)
downloadsamba-dcf1705782f5d589120624c90b695b81a0332e6b.tar.gz
samba-dcf1705782f5d589120624c90b695b81a0332e6b.tar.xz
samba-dcf1705782f5d589120624c90b695b81a0332e6b.zip
Add example of string overflow which is now caught in developer mode.
-rw-r--r--source/torture/t_stringoverflow.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/torture/t_stringoverflow.c b/source/torture/t_stringoverflow.c
new file mode 100644
index 00000000000..b0503adb8fa
--- /dev/null
+++ b/source/torture/t_stringoverflow.c
@@ -0,0 +1,16 @@
+#include "includes.h"
+
+ int main(void)
+{
+ fstring 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. */
+ pstrcpy(dest, "hello");
+
+ return 0;
+}