Description: Fix unaligned memory access Author: Christoph Biedl Bug: https://bitbucket.org/ripencc/bgpdump/issues/40 Last-Update: 2016-10-30 Causes FTBFS at least on sparc64 --- a/bgpdump_lib.c +++ b/bgpdump_lib.c @@ -1326,12 +1326,14 @@ space = 1; int asn_pos = i * as->asn_len; + u_int32_t temp; switch(as->asn_len) { case ASN16_LEN: asn = ntohs (*(u_int16_t *) (segment->data + asn_pos)); break; case ASN32_LEN: - asn = ntohl (*(u_int32_t *) (segment->data + asn_pos)); + memcpy (&temp, segment->data + asn_pos, sizeof (u_int32_t)); + asn = ntohl (temp); break; default: assert("invalid asn_len" && false);