Browse Source

Fix unaligned memory access

Christoph Biedl 4 years ago
parent
commit
d6f9d7f3f3
2 changed files with 26 additions and 0 deletions
  1. 25 0
      debian/patches/fix-unaligned-memory-access.patch
  2. 1 0
      debian/patches/series

+ 25 - 0
debian/patches/fix-unaligned-memory-access.patch

@@ -0,0 +1,25 @@
+Description: Fix unaligned memory access
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+https://bitbucket.org/ripencc/bgpdump/issues/
+Last-Update: 2016-10-30
+
+    Causes FTBFS at least on sparc64
+
+--- a/bgpdump_lib.c
++++ b/bgpdump_lib.c
+@@ -1295,12 +1295,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);

+ 1 - 0
debian/patches/series

@@ -12,3 +12,4 @@ increase-max-prefixes.patch
 
 # big test (see README.Debian)
 enhance-test-script.patch
+fix-unaligned-memory-access.patch