summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libelf/ChangeLog5
-rw-r--r--libelf/elf32_updatefile.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 5f66135f..b8c20cc6 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-30 Mark Wielaard <[email protected]>
+
+ * elf32_updatefile.c (updatemmap): Only call mempcpy and update
+ last_position when d_size is non-zero.
+
2015-05-17 Mark Wielaard <[email protected]>
* elf32_updatefile.c (updatefile): Allocate shdr_data and scns
diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c
index e90ad47d..913c3e46 100644
--- a/libelf/elf32_updatefile.c
+++ b/libelf/elf32_updatefile.c
@@ -367,7 +367,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
last_position += dl->data.d.d_size;
}
- else
+ else if (dl->data.d.d_size != 0)
last_position = mempcpy (last_position,
dl->data.d.d_buf,
dl->data.d.d_size);