98bad4f2b3
The following pattern is unsafe on all platforms: n = SNPRINTF(buf, ...); buf[n] = '\0'; On windows, the _snprintf variants return a negative number if the buffer was too small, thus buf[n] would be outside of (before the start of) the buffer. On other platforms, the C99 snprintf function returns the total number of characters which would have been written if the buffer had been large enough, which can be larger than the buffer size itself, and thus buf[n] would be beyond the end of the buffer. The C99 snprintf function always null terminate the buffer. These invocations of SNPRINTF are within !WIN32, so we can be sure that the SNPRINTF call itself already null terminated the buffer. |
||
---|---|---|
.. | ||
asm | ||
inc | ||
src |