From a48d8cad548f7ecf90352b3200cd6d1622272fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 21 May 2007 09:54:42 +0000 Subject: [PATCH] Test: Buffer overrun --- testbufferoverrun1/testbufferoverrun1.cpp | 5 +++-- testbufferoverrun2/err.msg | 1 + testbufferoverrun2/testbufferoverrun2.cpp | 8 ++++++++ testbufferoverrun3/err.msg | 0 testbufferoverrun3/testbufferoverrun3.cpp | 13 +++++++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 testbufferoverrun2/err.msg create mode 100644 testbufferoverrun2/testbufferoverrun2.cpp create mode 100644 testbufferoverrun3/err.msg create mode 100644 testbufferoverrun3/testbufferoverrun3.cpp diff --git a/testbufferoverrun1/testbufferoverrun1.cpp b/testbufferoverrun1/testbufferoverrun1.cpp index f99e340e0..f4c57d375 100644 --- a/testbufferoverrun1/testbufferoverrun1.cpp +++ b/testbufferoverrun1/testbufferoverrun1.cpp @@ -2,6 +2,7 @@ void f() { - char str[10]; - str[10] = 0; + char str[0x10]; + str[15] = 0; + str[16] = 0; } \ No newline at end of file diff --git a/testbufferoverrun2/err.msg b/testbufferoverrun2/err.msg new file mode 100644 index 000000000..fa65c7570 --- /dev/null +++ b/testbufferoverrun2/err.msg @@ -0,0 +1 @@ +[testbufferoverrun2\testbufferoverrun2.cpp:7]: Buffer overrun diff --git a/testbufferoverrun2/testbufferoverrun2.cpp b/testbufferoverrun2/testbufferoverrun2.cpp new file mode 100644 index 000000000..efa541c25 --- /dev/null +++ b/testbufferoverrun2/testbufferoverrun2.cpp @@ -0,0 +1,8 @@ + + +void f() +{ + char str[50]; + for (i = 0; i < 100; i++) + str[i] = 0; +} \ No newline at end of file diff --git a/testbufferoverrun3/err.msg b/testbufferoverrun3/err.msg new file mode 100644 index 000000000..e69de29bb diff --git a/testbufferoverrun3/testbufferoverrun3.cpp b/testbufferoverrun3/testbufferoverrun3.cpp new file mode 100644 index 000000000..c677e3338 --- /dev/null +++ b/testbufferoverrun3/testbufferoverrun3.cpp @@ -0,0 +1,13 @@ + + +void f() +{ + if (ab) + { + char str[50]; + } + if (ab) + { + char str[50]; + } +} \ No newline at end of file