Fix a potential buffer overflow in DNS-name handling