Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/external/mpl/bind/dist/lib/isc Pull up following revision...



details:   https://anonhg.NetBSD.org/src/rev/6e854feb1aa0
branches:  netbsd-9
changeset: 843321:6e854feb1aa0
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 03 17:31:02 2019 +0000

description:
Pull up following revision(s) (requested by christos in ticket #279):

        external/mpl/bind/dist/lib/isc/siphash.c: revision 1.3

PR/54594: Martin Husemann: bind may crash at startup

Use memcpy(3) instead of assuming casting "uint8_t *" to "uint64_t *" and
de-referencing works.

diffstat:

 external/mpl/bind/dist/lib/isc/siphash.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (26 lines):

diff -r e008320980f0 -r 6e854feb1aa0 external/mpl/bind/dist/lib/isc/siphash.c
--- a/external/mpl/bind/dist/lib/isc/siphash.c  Thu Oct 03 17:29:33 2019 +0000
+++ b/external/mpl/bind/dist/lib/isc/siphash.c  Thu Oct 03 17:31:02 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siphash.c,v 1.2.2.2 2019/09/12 19:18:16 martin Exp $   */
+/*     $NetBSD: siphash.c,v 1.2.2.3 2019/10/03 17:31:02 martin Exp $   */
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -60,9 +60,13 @@
 void
 isc_siphash24(const uint8_t *k, const uint8_t *in, size_t inlen, uint8_t *out)
 {
-       const uint64_t *key = (const uint64_t *)k;
-       uint64_t k0 = le64toh(key[0]);
-       uint64_t k1 = le64toh(key[1]);
+       uint64_t k0, k1;
+
+       memcpy(&k0, k, sizeof(k0));
+       memcpy(&k1, k + sizeof(k0), sizeof(k1));
+
+       k0 = le64toh(k0);
+       k1 = le64toh(k1);
 
        uint64_t v0 = 0x736f6d6570736575ULL ^ k0;
        uint64_t v1 = 0x646f72616e646f6dULL ^ k1;



Home | Main Index | Thread Index | Old Index