projects
/
platform
/
upstream
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4884c24
)
dnsproxy: Use memmove() when discarding domain name
author
Jukka Rissanen
<jukka.rissanen@linux.intel.com>
Fri, 1 Jun 2012 12:02:07 +0000
(15:02 +0300)
committer
Patrik Flykt
<patrik.flykt@linux.intel.com>
Thu, 7 Jun 2012 07:39:47 +0000
(10:39 +0300)
The memory areas can overlap so memmove() must be used.
src/dnsproxy.c
patch
|
blob
|
history
diff --git
a/src/dnsproxy.c
b/src/dnsproxy.c
index
f56c30c
..
49651a2
100644
(file)
--- 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));