fix buffer overflows in DNS resolution