]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libelf: Don't call memmove with possible NULL buffer.
authorMark Wielaard <mjw@redhat.com>
Sat, 30 May 2015 21:50:14 +0000 (23:50 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 5 Jun 2015 12:44:59 +0000 (14:44 +0200)
When size is zero the buffer src and dest buffers might be NULL.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libelf/ChangeLog
libelf/gelf_xlate.c

index b8c20cc68f1e8e437d671638fc3651b814955685..b749c0851af5f4ad7395fcb888b98076a797231e 100644 (file)
@@ -1,3 +1,7 @@
+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
index c417051a3a839c4343fd972bd77b1c9148bf6789..c5805e736949d95c9d03c4458a58f4ff2215a34a 100644 (file)
@@ -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);
 }