|
|
242bd2 |
From ab321a4f77eba0048c4cfb1081ae2c8e3496f3fd Mon Sep 17 00:00:00 2001
|
|
|
242bd2 |
From: willem <willem@af62348d-a3ea-0310-b058-bb613a78d823>
|
|
|
242bd2 |
Date: Tue, 12 Mar 2013 13:34:18 +0000
|
|
|
242bd2 |
Subject: [PATCH] - Uninitialized variable in securetrace.c - New install-sh
|
|
|
242bd2 |
(apperantly :) - Get rid of "dereferencing type-punned pointer will break
|
|
|
242bd2 |
strict-aliasing rules" warnings in sha2.c with gcc >= 4.7
|
|
|
242bd2 |
|
|
|
242bd2 |
git-svn-id: http://www.nlnetlabs.nl/svn/ldns@3826 af62348d-a3ea-0310-b058-bb613a78d823
|
|
|
242bd2 |
---
|
|
|
242bd2 |
trunk/drill/securetrace.c | 2 +-
|
|
|
242bd2 |
trunk/install-sh | 14 +++++++-------
|
|
|
242bd2 |
trunk/sha2.c | 15 ++++++++++++---
|
|
|
242bd2 |
3 files changed, 20 insertions(+), 11 deletions(-)
|
|
|
242bd2 |
|
|
|
242bd2 |
diff --git a/trunk/drill/securetrace.c b/trunk/drill/securetrace.c
|
|
|
242bd2 |
index c6e7e58..9d61ec0 100644
|
|
|
242bd2 |
--- a/trunk/drill/securetrace.c
|
|
|
242bd2 |
+++ b/trunk/drill/securetrace.c
|
|
|
242bd2 |
@@ -138,7 +138,7 @@ do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t,
|
|
|
242bd2 |
size_t j;
|
|
|
242bd2 |
size_t k;
|
|
|
242bd2 |
size_t l;
|
|
|
242bd2 |
- uint8_t labels_count;
|
|
|
242bd2 |
+ uint8_t labels_count = 0;
|
|
|
242bd2 |
|
|
|
242bd2 |
/* dnssec */
|
|
|
242bd2 |
ldns_rr_list *key_list;
|
|
|
242bd2 |
diff --git a/trunk/install-sh b/trunk/install-sh
|
|
|
242bd2 |
index a9244eb..377bb86 100755
|
|
|
242bd2 |
--- a/trunk/install-sh
|
|
|
242bd2 |
+++ b/trunk/install-sh
|
|
|
242bd2 |
@@ -1,7 +1,7 @@
|
|
|
242bd2 |
#!/bin/sh
|
|
|
242bd2 |
# install - install a program, script, or datafile
|
|
|
242bd2 |
|
|
|
242bd2 |
-scriptversion=2011-01-19.21; # UTC
|
|
|
242bd2 |
+scriptversion=2011-11-20.07; # UTC
|
|
|
242bd2 |
|
|
|
242bd2 |
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|
|
242bd2 |
# later released in X11R6 (xc/config/util/install.sh) with the
|
|
|
242bd2 |
@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
|
|
|
242bd2 |
# FSF changes to this file are in the public domain.
|
|
|
242bd2 |
#
|
|
|
242bd2 |
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
|
242bd2 |
-# `make' implicit rules from creating a file called install from it
|
|
|
242bd2 |
+# 'make' implicit rules from creating a file called install from it
|
|
|
242bd2 |
# when there is no Makefile.
|
|
|
242bd2 |
#
|
|
|
242bd2 |
# This script is compatible with the BSD install script, but was written
|
|
|
242bd2 |
@@ -156,7 +156,7 @@ while test $# -ne 0; do
|
|
|
242bd2 |
-s) stripcmd=$stripprog;;
|
|
|
242bd2 |
|
|
|
242bd2 |
-t) dst_arg=$2
|
|
|
242bd2 |
- # Protect names problematic for `test' and other utilities.
|
|
|
242bd2 |
+ # Protect names problematic for 'test' and other utilities.
|
|
|
242bd2 |
case $dst_arg in
|
|
|
242bd2 |
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
|
|
242bd2 |
esac
|
|
|
242bd2 |
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
|
|
242bd2 |
fi
|
|
|
242bd2 |
shift # arg
|
|
|
242bd2 |
dst_arg=$arg
|
|
|
242bd2 |
- # Protect names problematic for `test' and other utilities.
|
|
|
242bd2 |
+ # Protect names problematic for 'test' and other utilities.
|
|
|
242bd2 |
case $dst_arg in
|
|
|
242bd2 |
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
|
|
242bd2 |
esac
|
|
|
242bd2 |
@@ -202,7 +202,7 @@ if test $# -eq 0; then
|
|
|
242bd2 |
echo "$0: no input file specified." >&2
|
|
|
242bd2 |
exit 1
|
|
|
242bd2 |
fi
|
|
|
242bd2 |
- # It's OK to call `install-sh -d' without argument.
|
|
|
242bd2 |
+ # It's OK to call 'install-sh -d' without argument.
|
|
|
242bd2 |
# This can happen when creating conditional directories.
|
|
|
242bd2 |
exit 0
|
|
|
242bd2 |
fi
|
|
|
242bd2 |
@@ -240,7 +240,7 @@ fi
|
|
|
242bd2 |
|
|
|
242bd2 |
for src
|
|
|
242bd2 |
do
|
|
|
242bd2 |
- # Protect names problematic for `test' and other utilities.
|
|
|
242bd2 |
+ # Protect names problematic for 'test' and other utilities.
|
|
|
242bd2 |
case $src in
|
|
|
242bd2 |
-* | [=\(\)!]) src=./$src;;
|
|
|
242bd2 |
esac
|
|
|
242bd2 |
@@ -354,7 +354,7 @@ do
|
|
|
242bd2 |
if test -z "$dir_arg" || {
|
|
|
242bd2 |
# Check for POSIX incompatibilities with -m.
|
|
|
242bd2 |
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
|
|
242bd2 |
- # other-writeable bit of parent directory when it shouldn't.
|
|
|
242bd2 |
+ # other-writable bit of parent directory when it shouldn't.
|
|
|
242bd2 |
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
|
|
242bd2 |
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
|
|
242bd2 |
case $ls_ld_tmpdir in
|
|
|
242bd2 |
diff --git a/trunk/sha2.c b/trunk/sha2.c
|
|
|
242bd2 |
index 6ba4ab5..9a27122 100644
|
|
|
242bd2 |
--- a/trunk/sha2.c
|
|
|
242bd2 |
+++ b/trunk/sha2.c
|
|
|
242bd2 |
@@ -546,9 +546,15 @@ void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t
|
|
|
242bd2 |
usedspace = freespace = 0;
|
|
|
242bd2 |
}
|
|
|
242bd2 |
|
|
|
242bd2 |
+typedef union _ldns_sha2_buffer_union {
|
|
|
242bd2 |
+ uint8_t* theChars;
|
|
|
242bd2 |
+ uint64_t* theLongs;
|
|
|
242bd2 |
+} ldns_sha2_buffer_union;
|
|
|
242bd2 |
+
|
|
|
242bd2 |
void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
|
|
|
242bd2 |
sha2_word32 *d = (sha2_word32*)digest;
|
|
|
242bd2 |
size_t usedspace;
|
|
|
242bd2 |
+ ldns_sha2_buffer_union cast_var;
|
|
|
242bd2 |
|
|
|
242bd2 |
/* Sanity check: */
|
|
|
242bd2 |
assert(context != (ldns_sha256_CTX*)0);
|
|
|
242bd2 |
@@ -585,7 +591,8 @@ void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) {
|
|
|
242bd2 |
*context->buffer = 0x80;
|
|
|
242bd2 |
}
|
|
|
242bd2 |
/* Set the bit count: */
|
|
|
242bd2 |
- *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount;
|
|
|
242bd2 |
+ cast_var.theChars = context->buffer;
|
|
|
242bd2 |
+ cast_var.theLongs[ldns_sha256_SHORT_BLOCK_LENGTH / 8] = context->bitcount;
|
|
|
242bd2 |
|
|
|
242bd2 |
/* final transform: */
|
|
|
242bd2 |
ldns_sha256_Transform(context, (sha2_word32*)context->buffer);
|
|
|
242bd2 |
@@ -850,6 +857,7 @@ void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t
|
|
|
242bd2 |
|
|
|
242bd2 |
static void ldns_sha512_Last(ldns_sha512_CTX* context) {
|
|
|
242bd2 |
size_t usedspace;
|
|
|
242bd2 |
+ ldns_sha2_buffer_union cast_var;
|
|
|
242bd2 |
|
|
|
242bd2 |
usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH;
|
|
|
242bd2 |
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
242bd2 |
@@ -882,8 +890,9 @@ static void ldns_sha512_Last(ldns_sha512_CTX* context) {
|
|
|
242bd2 |
*context->buffer = 0x80;
|
|
|
242bd2 |
}
|
|
|
242bd2 |
/* Store the length of input data (in bits): */
|
|
|
242bd2 |
- *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
|
|
|
242bd2 |
- *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
|
|
|
242bd2 |
+ cast_var.theChars = context->buffer;
|
|
|
242bd2 |
+ cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
|
|
|
242bd2 |
+ cast_var.theLongs[ldns_sha512_SHORT_BLOCK_LENGTH / 8 + 1] = context->bitcount[0];
|
|
|
242bd2 |
|
|
|
242bd2 |
/* final transform: */
|
|
|
242bd2 |
ldns_sha512_Transform(context, (sha2_word64*)context->buffer);
|
|
|
242bd2 |
--
|
|
|
242bd2 |
1.8.3.1
|
|
|
242bd2 |
|