cat.Can_I_pet= true; cat.Should_I_pet= false
Enable HLS to view with audio, or disable this notification
Enable HLS to view with audio, or disable this notification
r/C_AT • u/GdbZeroOfficial • 1d ago
Quick breakdown of what happens here: buffer lives on create_name()'s stack frame. Once the function returns, the stack pointer moves back and the next function call overwrites those bytes.
Compiling with -Wall -Wextra -Werror and -fsanitize=address catches this immediately at runtime before it hits production.
(If anyone wants a printable 10-page GDB/Valgrind/ASan reference sheet I wrote for these labs, it's free on my profile).
r/C_AT • u/thejohnd • 5d ago
#embeddedC@T #C@Tmods #IoC #internetofcats