[LLVMdev] [Patch] WinCOFFObjectWriter: fix for storing pointer to string table in header name field
Nico Rieck
nico.rieck at gmail.com
Tue Jul 23 10:10:54 PDT 2013
On 23.07.2013 18:55, Reid Kleckner wrote:
> Please don't assume snprintf always null terminates.
I'm reading C99 7.19.6.4 and C11 7.21.6.5 which says:
"If n is zero, nothing is written, and s may be a null pointer.
Otherwise, output characters beyond the n-1st are discarded rather
than being written to the array, and a null character is written at the
end of the characters actually written into the array."
and "Thus, the null-terminated output has been
completely written if and only if the returned value is nonnegative and
less than n."
-Nico
More information about the llvm-dev
mailing list