From a7ef300d732a49ba0177dd9f1a142387cdc1766e Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Mon, 15 Aug 2022 12:40:51 +0100 Subject: [PATCH] Buffer Overflow test. --- main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index e7426f6..6a42f28 100644 --- a/main.cpp +++ b/main.cpp @@ -1,13 +1,13 @@ #include -void print(int x) -{ - std::cout << x; -} - int main() { - constexpr float testVal { 5.5F }; - print(static_cast(testVal)); + //char name[5] = {'t', 'e', 's', 't', '\0'}; + char name[5] = "test"; + char* t = name; + std::cout << t; + t[1] = 'a'; + t[4] = 'b'; + std::cout << t; return 0; }