/in/foo.cc: In function 'std::string daysToDate(int)':
/in/foo.cc:55:24: warning: '%02d' directive writing 2 bytes into a region of size between 0 and 6 [-Wformat-overflow=]
55 | sprintf(buf, "%04d-%02d-%02d", y, m, d);
| ^~~~
/in/foo.cc:55:18: note: directive argument in the range [1, 13]
55 | sprintf(buf, "%04d-%02d-%02d", y, m, d);
| ^~~~~~~~~~~~~~~~
/in/foo.cc:55:18: note: directive argument in the range [-2147483647, 2147483647]
In file included from /usr/include/stdio.h:867,
from /usr/include/c++/9/cstdio:42,
from /usr/include/c++/9/ext/string_conversions.h:43,
from /usr/include/c++/9/bits/basic_string.h:6496,
from /usr/include/c++/9/string:55,
from /usr/include/c++/9/bits/locale_classes.h:40,
from /usr/include/c++/9/bits/ios_base.h:41,
from /usr/include/c++/9/ios:42,
from /usr/include/c++/9/ostream:38,
from /usr/include/c++/9/iostream:39,
from /in/foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:34: note: '__builtin___sprintf_chk' output between 11 and 26 bytes into a destination of size 11
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~