mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-11 07:01:37 +00:00
client controller/foreign_menu: use memmove instead of memcpy in readers
When src/dst memory areas may overlap, it's safer to use memmove.
(cherry picked from commit 5d28d1662e)
This commit is contained in:
parent
1f2d55b38b
commit
baa375e8b5
@ -213,7 +213,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;
|
||||
|
||||
@ -234,7 +234,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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user