1
0

upstream.fix-unaligned-memory-access.patch 874 B

12345678910111213141516171819202122232425
  1. Description: Fix unaligned memory access
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug: https://bitbucket.org/ripencc/bgpdump/issues/40
  4. Last-Update: 2016-10-30
  5. Causes FTBFS at least on sparc64
  6. --- a/bgpdump_lib.c
  7. +++ b/bgpdump_lib.c
  8. @@ -1326,12 +1326,14 @@
  9. space = 1;
  10. int asn_pos = i * as->asn_len;
  11. + u_int32_t temp;
  12. switch(as->asn_len) {
  13. case ASN16_LEN:
  14. asn = ntohs (*(u_int16_t *) (segment->data + asn_pos));
  15. break;
  16. case ASN32_LEN:
  17. - asn = ntohl (*(u_int32_t *) (segment->data + asn_pos));
  18. + memcpy (&temp, segment->data + asn_pos, sizeof (u_int32_t));
  19. + asn = ntohl (temp);
  20. break;
  21. default:
  22. assert("invalid asn_len" && false);