]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4621. [port] Force alignment of oid arrays to silence loader
authorMark Andrews <marka@isc.org>
Wed, 10 May 2017 23:24:36 +0000 (09:24 +1000)
committerMark Andrews <marka@isc.org>
Wed, 10 May 2017 23:25:07 +0000 (09:25 +1000)
                        warnings. [RT #45131]

(cherry picked from commit 2fb1a0bdefd4f6a58c816ae65bf5a7fa1310ebbe)

CHANGES
lib/dns/spnego.c

diff --git a/CHANGES b/CHANGES
index 057086c1e6cf585c10ed6ea615c29eb7b2b17c30..b61cc9a99f5990939458df7246e8825dc36431b5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4621.  [port]          Force alignment of oid arrays to silence loader
+                       warnings. [RT #45131]
+
 4620.  [port]          Handle EPFNOSUPPORT being returned when probing
                        to see if a socket type is supported. [RT #45214]
 
index 9ab13ef3df83838de5fd352a202978c1f7b46d6d..cdc738734f2e7abf36bc737b299d39ef58b97025 100644 (file)
@@ -319,35 +319,39 @@ fix_dce(size_t reallen, size_t * len);
 
 #include "spnego_asn1.c"
 
-static unsigned char gss_krb5_mech_oid_bytes[] = {
-       0x2a, 0x86, 0x48, 0x86, 0xf7, 0x12, 0x01, 0x02, 0x02
+/*
+ * Force the oid arrays to be isc_uint64_t aligned to silence warnings
+ * about the arrays not being properly aligned for (void *).
+ */
+typedef union { unsigned char b[8]; isc_uint64_t _align; } aligned8;
+typedef union { unsigned char b[16]; isc_uint64_t _align[2]; } aligned16;
+
+static aligned16 gss_krb5_mech_oid_bytes = {
+       { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x12, 0x01, 0x02, 0x02 }
 };
 
 static gss_OID_desc gss_krb5_mech_oid_desc = {
-       sizeof(gss_krb5_mech_oid_bytes),
-       gss_krb5_mech_oid_bytes
+       9, gss_krb5_mech_oid_bytes.b
 };
 
 static gss_OID GSS_KRB5_MECH = &gss_krb5_mech_oid_desc;
 
-static unsigned char gss_mskrb5_mech_oid_bytes[] = {
-       0x2a, 0x86, 0x48, 0x82, 0xf7, 0x12, 0x01, 0x02, 0x02
+static aligned16 gss_mskrb5_mech_oid_bytes = {
+       { 0x2a, 0x86, 0x48, 0x82, 0xf7, 0x12, 0x01, 0x02, 0x02 }
 };
 
 static gss_OID_desc gss_mskrb5_mech_oid_desc = {
-       sizeof(gss_mskrb5_mech_oid_bytes),
-       gss_mskrb5_mech_oid_bytes
+       9, gss_mskrb5_mech_oid_bytes.b
 };
 
 static gss_OID GSS_MSKRB5_MECH = &gss_mskrb5_mech_oid_desc;
 
-static unsigned char gss_spnego_mech_oid_bytes[] = {
-       0x2b, 0x06, 0x01, 0x05, 0x05, 0x02
+static aligned8 gss_spnego_mech_oid_bytes = {
+       { 0x2b, 0x06, 0x01, 0x05, 0x05, 0x02 }
 };
 
 static gss_OID_desc gss_spnego_mech_oid_desc = {
-       sizeof(gss_spnego_mech_oid_bytes),
-       gss_spnego_mech_oid_bytes
+       6, gss_spnego_mech_oid_bytes.b
 };
 
 static gss_OID GSS_SPNEGO_MECH = &gss_spnego_mech_oid_desc;