]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
- Uninitialized variable in securetrace.c
authorWillem Toorop <willem@NLnetLabs.nl>
Tue, 12 Mar 2013 13:34:18 +0000 (13:34 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Tue, 12 Mar 2013 13:34:18 +0000 (13:34 +0000)
- New install-sh (apperantly :)
- Get rid of "dereferencing type-punned pointer will break strict-aliasing rules" warnings in sha2.c with gcc >= 4.7

drill/securetrace.c
install-sh
sha2.c

index c6e7e588409a12ca69ec34ea7cab460c393cafc6..9d61ec0900e4577dd33d6902aa425bb11d6a7141 100644 (file)
@@ -138,7 +138,7 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t,
        size_t j;
        size_t k;
        size_t l;
-       uint8_t labels_count;
+       uint8_t labels_count = 0;
 
        /* dnssec */
        ldns_rr_list *key_list;
index a9244eb0786534553fdd9eb0050bb4b172bad0a3..377bb8687ffe16bfc79ea25c8667cabf72aaf2c2 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2011-11-20.07; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
@@ -156,7 +156,7 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
-       # Protect names problematic for `test' and other utilities.
+       # Protect names problematic for 'test' and other utilities.
        case $dst_arg in
          -* | [=\(\)!]) dst_arg=./$dst_arg;;
        esac
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
-    # Protect names problematic for `test' and other utilities.
+    # Protect names problematic for 'test' and other utilities.
     case $dst_arg in
       -* | [=\(\)!]) dst_arg=./$dst_arg;;
     esac
@@ -202,7 +202,7 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call `install-sh -d' without argument.
+  # It's OK to call 'install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 fi
@@ -240,7 +240,7 @@ fi
 
 for src
 do
-  # Protect names problematic for `test' and other utilities.
+  # Protect names problematic for 'test' and other utilities.
   case $src in
     -* | [=\(\)!]) src=./$src;;
   esac
@@ -354,7 +354,7 @@ do
              if test -z "$dir_arg" || {
                   # Check for POSIX incompatibilities with -m.
                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-                  # other-writeable bit of parent directory when it shouldn't.
+                  # other-writable bit of parent directory when it shouldn't.
                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
                   case $ls_ld_tmpdir in
diff --git a/sha2.c b/sha2.c
index 6ba4ab5cb1e09e49c765fe89475af6300fdbeeae..9a27122bfe1e3b38a39252b9dc76c227231bc9ff 100644 (file)
--- a/sha2.c
+++ b/sha2.c
@@ -546,9 +546,15 @@ void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t
        usedspace = freespace = 0;
 }
 
+typedef union _ldns_sha2_buffer_union {
+        uint8_t*  theChars;
+        uint64_t* theLongs;
+} ldns_sha2_buffer_union;
+
 void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
        sha2_word32     *d = (sha2_word32*)digest;
        size_t usedspace;
+       ldns_sha2_buffer_union cast_var;
 
        /* Sanity check: */
        assert(context != (ldns_sha256_CTX*)0);
@@ -585,7 +591,8 @@ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
                        *context->buffer = 0x80;
                }
                /* Set the bit count: */
-               *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount;
+               cast_var.theChars = context->buffer;
+               cast_var.theLongs[ldns_sha256_SHORT_BLOCK_LENGTH / 8] = context->bitcount;
 
                /* final transform: */
                ldns_sha256_Transform(context, (sha2_word32*)context->buffer);
@@ -850,6 +857,7 @@ void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t
 
 static void ldns_sha512_Last(ldns_sha512_CTX* context) {
        size_t usedspace;
+       ldns_sha2_buffer_union cast_var;
 
        usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -882,8 +890,9 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
                *context->buffer = 0x80;
        }
        /* Store the length of input data (in bits): */
-       *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
-       *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
+       cast_var.theChars = context->buffer;
+       cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
+       cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0];
 
        /* final transform: */
        ldns_sha512_Transform(context, (sha2_word64*)context->buffer);