client controller/foreign_menu: use memmove instead of memcpy in readers

When src/dst memory areas may overlap, it's safer to use memmove.
This commit is contained in:
Uri Lublin 2011-12-06 15:36:38 +02:00
parent ffc4de01e6
commit 5d28d1662e
2 changed files with 2 additions and 2 deletions

View File

@ -216,7 +216,7 @@ bool ControllerConnection::read_msgs()
pos += hdr->size;
}
if (nread > 0 && pos != _read_buf) {
memcpy(_read_buf, pos, nread);
memmove(_read_buf, pos, nread);
}
_read_pos = _read_buf + nread;
return true;

View File

@ -237,7 +237,7 @@ bool ForeignMenuConnection::read_msgs()
pos += hdr->size;
}
if (nread > 0 && pos != _read_buf) {
memcpy(_read_buf, pos, nread);
memmove(_read_buf, pos, nread);
}
_read_pos = _read_buf + nread;
return true;