servalproject / serval-dna

The Serval Project's core daemon that implements Distributed Numbering Architecture (DNA), MDP, VoMP, Rhizome, MeshMS, etc.
http://servalproject.org
Other
171 stars 80 forks source link

Fix varargs use #63

Closed rom1v closed 11 years ago

rom1v commented 11 years ago

forum thread

man stdarg says:

If ap is passed to a function that uses va_arg(ap,type) then the value of ap is undefined after the return of that function.

va_start(…) and va_end(…) must be called at each iteration.

By chance, it worked in 32 bits, but it segfaulted in 64 bits.

See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31484