summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
56224ea)
netsec_vprintf() can call vsnprintf() twice if the outgoing buffer is
full (but it happens rarely in practice, given the way the current
code uses it). But if this DOES happen, vsnprintf() will use the
same va_list argument twice, and the second time around either it will
grab a random bit of memory off of the stack OR it will segfault.
So we always use va_copy() to get our own copy of the passed-in va_list
and work on that.
/*
* Cheat a little. If we can fit the data into our outgoing buffer,
/*
* Cheat a little. If we can fit the data into our outgoing buffer,
rc = vsnprintf((char *) nsc->ns_outptr,
rc = vsnprintf((char *) nsc->ns_outptr,
- nsc->ns_outbufsize - nsc->ns_outbuflen, format, ap);
+ nsc->ns_outbufsize - nsc->ns_outbuflen, format, apcopy);
+ va_end(apcopy);
if (rc >= (int) (nsc->ns_outbufsize - nsc->ns_outbuflen)) {
/*
if (rc >= (int) (nsc->ns_outbufsize - nsc->ns_outbuflen)) {
/*