Fix -Wcast-align warnings/errors on ARM

On ARM, struct's with int or long's require natural alignment, so
you can not cast from a char* buffer to a struct, as that might
produce unaligned accesses of struct members.

The only portable way is to memcpy it into a properly aligned memory
location, which is what this patch does.