diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-06-01 15:02:07 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-06-07 10:39:47 +0300 |
commit | 6ca02c55add42f4d25114c77de9ef020221e7ab8 (patch) | |
tree | 6ba7aff84379b185555e31071c6537e7965e9566 /src/dnsproxy.c | |
parent | 4884c249bf7f098bbffd1a704a0a5ade573bee54 (diff) | |
download | connman-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.c | 6 |
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)); |