X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fdnsproxy.c;h=5c4099bdfafd7be9a55617588abe708d9197c2c0;hb=46d7e52dcabccff5e010a6aa7232fbbfea1abecb;hp=83ec419eac5faf95ee2f6eadccfb3bad2d3f7212;hpb=c6ea537a72b6bf522afad18bf84fd9b3e9ab522b;p=framework%2Fconnectivity%2Fconnman.git diff --git a/src/dnsproxy.c b/src/dnsproxy.c index 83ec419..5c4099b 100644 --- a/src/dnsproxy.c +++ b/src/dnsproxy.c @@ -1551,13 +1551,13 @@ static int forward_dns_reply(unsigned char *reply, int reply_len, int protocol, */ 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)); @@ -2272,7 +2272,7 @@ static int parse_request(unsigned char *buf, int 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);