From 71fcce97d86fa8db40803f653f308c0c87525551 Mon Sep 17 00:00:00 2001 From: Cole Gannaway <156719330+cole-gannaway-sonarsource@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:59:57 -0500 Subject: [PATCH] Create bad.cpp --- samples/cpp/bad.cpp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 samples/cpp/bad.cpp diff --git a/samples/cpp/bad.cpp b/samples/cpp/bad.cpp new file mode 100644 index 000000000000..833d439adc9b --- /dev/null +++ b/samples/cpp/bad.cpp @@ -0,0 +1,7 @@ +#include + +int badFunction() { + char str[20]; + gets(str); // Noncompliant; `str` buffer size is not checked and it is vulnerable to overflows + return 0; +}