libdyld: handle unaligned relocations.
authorwhitequark <whitequark@whitequark.org>
Sat, 1 Aug 2015 17:26:27 +0000 (20:26 +0300)
committerwhitequark <whitequark@whitequark.org>
Sat, 1 Aug 2015 17:26:27 +0000 (20:26 +0300)
software/libdyld/dyld.c

index 50a48f2fd0a0183ad18eaa889c34a12ce067f3a9..c6bdae486f873b3eef0112d2a641bec72f557908 100644 (file)
@@ -43,7 +43,8 @@ static int fixup_rela(struct dyld_info *info, Elf32_Rela *rela,
         return 0;
     }
 
-    *(Elf32_Addr*)(info->base + rela->r_offset) = value;
+    memcpy((Elf32_Addr*)(info->base + rela->r_offset), &value,
+           sizeof(Elf32_Addr));
 
     return 1;
 }