https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81401
Jörg Richter <joerg.rich...@pdv-fs.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joerg.rich...@pdv-fs.de --- Comment #2 from Jörg Richter <joerg.rich...@pdv-fs.de> --- See also: #include <stdio.h> void foo() { char buf[2]; for( int i = 0; i < 10; ++i ) sprintf( buf, "%d", i ); } t.cc: In function 'void foo()': t.cc:2:6: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=] void foo() ^~~ t.cc:6:12: note: 'sprintf' output between 2 and 3 bytes into a destination of size 2 sprintf( buf, "%d", i ); ~~~~~~~^~~~~~~~~~~~~~~~