]> diplodocus.org Git - nmh/commit
Use va_copy() to get a copy of va_list, instead of using original.
authorKen Hornstein <kenh@pobox.com>
Sat, 4 Nov 2017 13:59:18 +0000 (09:59 -0400)
committerKen Hornstein <kenh@pobox.com>
Sat, 4 Nov 2017 13:59:18 +0000 (09:59 -0400)
commitb47b562525f149f175c3d216feea20a6db2e9ff5
tree1cd801091ef42727bd852390cee793503c3105b3
parent56224eac0c7aa1912b4e0de4fe38b664888f0f2b
Use va_copy() to get a copy of va_list, instead of using original.

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.
sbr/netsec.c