diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-05-30 23:50:14 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-06-05 14:44:59 +0200 |
commit | fc9b79400a7bf1aa399cadf5e0351d757a4e44a6 (patch) | |
tree | 0a743de759691af958847b3d3c9bd2380c50466a /libelf | |
parent | b4ad3c4b81c57b36d9837dc81523cfa7950f30a7 (diff) | |
download | elfutils-fc9b79400a7bf1aa399cadf5e0351d757a4e44a6.tar.gz |
libelf: Don't call memmove with possible NULL buffer.
When size is zero the buffer src and dest buffers might be NULL.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf')
-rw-r--r-- | libelf/ChangeLog | 4 | ||||
-rw-r--r-- | libelf/gelf_xlate.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog index b8c20cc6..b749c085 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,5 +1,9 @@ 2015-05-30 Mark Wielaard <mjw@redhat.com> + * gelf_xlate.c (elf_cvt_Byte): Only call memmove with non-zero size. + +2015-05-30 Mark Wielaard <mjw@redhat.com> + * elf32_updatefile.c (updatemmap): Only call mempcpy and update last_position when d_size is non-zero. diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c index c417051a..c5805e73 100644 --- a/libelf/gelf_xlate.c +++ b/libelf/gelf_xlate.c @@ -1,5 +1,5 @@ /* Transformation functions for ELF data types. - Copyright (C) 1998,1999,2000,2002,2004,2005,2006,2007 Red Hat, Inc. + Copyright (C) 1998,1999,2000,2002,2004,2005,2006,2007,2015 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -52,7 +52,8 @@ static void (elf_cvt_Byte) (void *dest, const void *src, size_t n, int encode __attribute__ ((unused))) { - memmove (dest, src, n); + if (n != 0) + memmove (dest, src, n); } |