mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-16 13:18:12 +01:00
[Linux] Fix potentially overlapping memory-copy to use memmove() instead
of memcpy().
This commit is contained in:
parent
87247220a9
commit
253f3e5738
1 changed files with 2 additions and 2 deletions
|
@ -228,7 +228,7 @@ maps_next (struct map_iterator *mi,
|
||||||
{
|
{
|
||||||
/* copy down the remaining bytes, if any */
|
/* copy down the remaining bytes, if any */
|
||||||
if (bytes_left > 0)
|
if (bytes_left > 0)
|
||||||
memcpy (mi->buf_end - mi->buf_size, mi->buf, bytes_left);
|
memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left);
|
||||||
|
|
||||||
mi->buf = mi->buf_end - mi->buf_size;
|
mi->buf = mi->buf_end - mi->buf_size;
|
||||||
nread = read (mi->fd, mi->buf + bytes_left,
|
nread = read (mi->fd, mi->buf + bytes_left,
|
||||||
|
@ -240,7 +240,7 @@ maps_next (struct map_iterator *mi,
|
||||||
/* Move contents to the end of the buffer so we
|
/* Move contents to the end of the buffer so we
|
||||||
maintain the invariant that all bytes between
|
maintain the invariant that all bytes between
|
||||||
mi->buf and mi->buf_end are valid. */
|
mi->buf and mi->buf_end are valid. */
|
||||||
memcpy (mi->buf_end - nread - bytes_left, mi->buf,
|
memmove (mi->buf_end - nread - bytes_left, mi->buf,
|
||||||
nread + bytes_left);
|
nread + bytes_left);
|
||||||
mi->buf = mi->buf_end - nread - bytes_left;
|
mi->buf = mi->buf_end - nread - bytes_left;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue