Add example of string overflow which is now caught in developer mode.
authorMartin Pool <mbp@samba.org>
Wed, 12 Mar 2003 02:57:48 +0000 (02:57 +0000)
committerMartin Pool <mbp@samba.org>
Wed, 12 Mar 2003 02:57:48 +0000 (02:57 +0000)
(This used to be commit dcf1705782f5d589120624c90b695b81a0332e6b)

source3/torture/t_stringoverflow.c [new file with mode: 0644]

diff --git a/source3/torture/t_stringoverflow.c b/source3/torture/t_stringoverflow.c
new file mode 100644 (file)
index 0000000..b0503ad
--- /dev/null
@@ -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;
+}