[Spice-devel] [PATCH 1/4] client controller/foreign_menu: use memmove instead of memcpy in readers
Alon Levy
alevy at redhat.com
Tue Dec 20 09:02:43 PST 2011
On Tue, Dec 20, 2011 at 06:52:02PM +0200, Uri Lublin wrote:
> When src/dst memory areas may overlap, it's safer to use memmove.
ACK.
> ---
> client/controller.cpp | 2 +-
> client/foreign_menu.cpp | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/client/controller.cpp b/client/controller.cpp
> index e7c4b95..91c0021 100644
> --- a/client/controller.cpp
> +++ b/client/controller.cpp
> @@ -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;
> diff --git a/client/foreign_menu.cpp b/client/foreign_menu.cpp
> index 926e266..00cc57c 100644
> --- a/client/foreign_menu.cpp
> +++ b/client/foreign_menu.cpp
> @@ -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;
> --
> 1.7.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list