This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gelf_getauxv: Use memcpy instead of pointer dereference to avoid alignment problems.


---
 libelf/ChangeLog      |    5 +++++
 libelf/gelf_getauxv.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 674a720..46d4731 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-25  Kurt Roeckx  <kurt@roeckx.be>
+
+	* gelf_getauxv.c (gelf_getauxv): Use memcpy instead of pointer
+	dereference to avoid alignment problems.
+
 2013-01-07  Roland McGrath  <roland@hack.frob.com>
 
 	* elf_getarsym.c (elf_getarsym): Copy FILE_DATA into stack space if it
diff --git a/libelf/gelf_getauxv.c b/libelf/gelf_getauxv.c
index d87362e..be24667 100644
--- a/libelf/gelf_getauxv.c
+++ b/libelf/gelf_getauxv.c
@@ -97,7 +97,7 @@ gelf_getauxv (data, ndx, dst)
 	  goto out;
 	}
 
-      *dst = ((GElf_auxv_t *) data_scn->d.d_buf)[ndx];
+      memcpy(dst, &((GElf_auxv_t *) data_scn->d.d_buf)[ndx], sizeof(*dst));
     }
 
   result = dst;
-- 
1.7.10.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]