![stack smashing detected stratum terminated stack smashing detected stratum terminated](https://0xswitch.fr/static/img/articles/leak-via-stack-smashing-protection/gdb_2.png)
![stack smashing detected stratum terminated stack smashing detected stratum terminated](https://media.springernature.com/lw685/springer-static/image/art%3A10.1038%2Fs41598-021-93682-y/MediaObjects/41598_2021_93682_Fig9_HTML.png)
Minimal reproduction example with disassembly analysis Valgrind doesn't work well with stack-related errors, but like a debugger, it may help you pin-point the location and reason for the crash. You can get some information about the point of overflow by running the program with a debugger. Note that -fstack-protector should always be turned on for release builds as it is a security feature.
![stack smashing detected stratum terminated stack smashing detected stratum terminated](https://static.wikia.nocookie.net/cookieclicker/images/2/2e/All_Upgrades.png)
![stack smashing detected stratum terminated stack smashing detected stratum terminated](https://image.slidesharecdn.com/main-130110034013-phpapp01/95/smashing-the-stack-31-638.jpg)
In that case you will get a different error, most likely a segmentation fault as you are trying to access an illegal memory location. To get some insight, you can try disabling this protection of gcc using option -fno-stack-protector while compiling. An input string of size greater than 10 causes corruption of this variable resulting in SIGABRT to terminate the program. The compiler, (in this case gcc) adds protection variables (called canaries) which have known values. For example in the following snippet: #include Stack Smashing here is actually caused due to a protection mechanism used by gcc to detect buffer overflow errors.