summaryrefslogtreecommitdiff
path: root/src/dnsproxy.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-06-01 15:02:07 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-06-07 10:39:47 +0300
commit6ca02c55add42f4d25114c77de9ef020221e7ab8 (patch)
tree6ba7aff84379b185555e31071c6537e7965e9566 /src/dnsproxy.c
parent4884c249bf7f098bbffd1a704a0a5ade573bee54 (diff)
downloadconnman-6ca02c55add42f4d25114c77de9ef020221e7ab8.tar.gz
connman-6ca02c55add42f4d25114c77de9ef020221e7ab8.tar.bz2
connman-6ca02c55add42f4d25114c77de9ef020221e7ab8.zip
dnsproxy: Use memmove() when discarding domain name
The memory areas can overlap so memmove() must be used.
Diffstat (limited to 'src/dnsproxy.c')
-rw-r--r--src/dnsproxy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index f56c30cb..49651a25 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -1565,7 +1565,11 @@ static int forward_dns_reply(unsigned char *reply, int reply_len, int protocol,
* name. In this case we end up in this branch.
*/
if (domain_len > 0) {
- memcpy(ptr + host_len + 1,
+ /*
+ * Note that we must use memmove() here,
+ * because the memory areas can overlap.
+ */
+ memmove(ptr + host_len + 1,
ptr + host_len + domain_len + 1,
reply_len - (ptr - reply + domain_len));