gelf_getauxv: Use memcpy, not pointer deref, to avoid alignment problems.
authorKurt Roeckx <kurt@roeckx.be>
Sun, 25 Aug 2013 21:15:13 +0000 (23:15 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 26 Aug 2013 14:27:35 +0000 (16:27 +0200)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
libelf/ChangeLog
libelf/gelf_getauxv.c

index 674a720..46d4731 100644 (file)
@@ -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
index d87362e..2a5b6f0 100644 (file)
@@ -97,7 +97,8 @@ gelf_getauxv (data, ndx, dst)
          goto out;
        }
 
-      *dst = ((GElf_auxv_t *) data_scn->d.d_buf)[ndx];
+      memcpy(dst, (char *) data_scn->d.d_buf + ndx * sizeof (GElf_auxv_t),
+            sizeof (GElf_auxv_t));
     }
 
   result = dst;