]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Alignment error
authorWillem Toorop <willem@nlnetlabs.nl>
Sat, 25 Jan 2025 22:18:37 +0000 (23:18 +0100)
committerWillem Toorop <willem@nlnetlabs.nl>
Sat, 25 Jan 2025 22:18:37 +0000 (23:18 +0100)
examples/ldns-verify-zone.c
sha2.c

index f4ad62fab2071162fb735e3bba15f969ed9cfc6d..5c29a7583aa658b58179613144134bf835c86329 100644 (file)
@@ -938,9 +938,10 @@ main(int argc, char **argv)
 
        if (zonemd_required == 1
        &&  !ldns_dnssec_zone_find_rrset(dnssec_zone,
-                               dnssec_zone->soa->name, LDNS_RR_TYPE_DNSKEY))
+                               dnssec_zone->soa->name, LDNS_RR_TYPE_DNSKEY)) {
+               ldns_rr_list_deep_free(keys);
                result = LDNS_STATUS_OK;
-       else
+       else
                result = verify_dnssec_zone(dnssec_zone,
                                dnssec_zone->soa->name, keys, apexonly,
                                percentage, zonemd_required > 2);
@@ -972,7 +973,6 @@ main(int argc, char **argv)
 
        ldns_dnssec_zone_deep_free(dnssec_zone);
        fclose(fp);
-       ldns_rr_list_deep_free(keys);
        exit(result);
 }
 
diff --git a/sha2.c b/sha2.c
index 8988ee06d04b010d0bf33a0393f111c7b72382e4..6a795b1f3983de0ce60169f5c03ab71da19d3f9a 100644 (file)
--- a/sha2.c
+++ b/sha2.c
@@ -737,6 +737,7 @@ static void ldns_sha512_Transform(ldns_sha512_CTX* context,
        sha2_word64     a, b, c, d, e, f, g, h, s0, s1;
        sha2_word64     T1, T2, *W512 = (sha2_word64*)context->buffer;
        int             j;
+       sha2_word64     aligned;
 
        /* initialize registers with the prev. intermediate value */
        a = context->state[0];
@@ -752,7 +753,8 @@ static void ldns_sha512_Transform(ldns_sha512_CTX* context,
        do {
 #if BYTE_ORDER == LITTLE_ENDIAN
                /* Convert TO host byte order */
-               REVERSE64(*data++, W512[j]);
+               memcpy(&aligned, data++, sizeof(aligned));
+               REVERSE64(aligned, W512[j]);
                /* Apply the SHA-512 compression function to update a..h */
                T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
 #else /* BYTE_ORDER == LITTLE_ENDIAN */