I\'m getting the following gcc format-truncation warning:
test.c:8:33: warning: ‘/input’ directive output may be truncated writing 6 bytes into a region of s
This error is only triggered when length-limited *printf
functions are called (snprintf
, vsnprintf
). In other words, it is not an indication that you may be writing into unallocated memory, as may happen with sprintf; it only notifies you that you aren't paying attention to when snprintf
may be doing is job and truncating.
Knowing that, I'm much more sanguine about disabling it globally using -Wno-format-truncation
, rather than trying to coax gcc
into ignoring a specific instance.