always reset random generator, even if HAVE_ARC4RANDOM
Protect stunEncode() function by performing buffer size checks