*/
ptr = reply + offset + sizeof(struct domain_hdr);
host_len = *ptr;
- domain_len = strlen((const char *)ptr) - host_len - 1;
+ domain_len = strlen((const char *)ptr + host_len + 1);
/*
- * remove the domain name and replaced it by the end
+ * remove the domain name and replace it by the end
* of reply.
*/
- memmove(ptr + host_len + 1,
+ memcpy(ptr + host_len + 1,
ptr + host_len + domain_len + 1,
reply_len - (ptr - reply + domain_len));
if (hdr->qr != 0 || qdcount != 1)
return -EINVAL;
- memset(name, 0, size);
+ name[0] = '\0';
ptr = buf + sizeof(struct domain_hdr);
remain = len - sizeof(struct domain_hdr);