From: Benjamin Kaduk Date: Wed, 11 Oct 2017 13:18:13 +0000 (-0500) Subject: Appease -Werror=maybe-uninitialized X-Git-Tag: OpenSSL_1_1_1-pre1~575 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=165cc51f4ed3b2b84db7e3e00ee7134a1b2a3574 Appease -Werror=maybe-uninitialized test/bad_dtls_test.c: In function 'validate_client_hello': test/bad_dtls_test.c:128:33: error: 'u' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (!PACKET_get_1(&pkt, &u) || u != SSL3_RT_HANDSHAKE) ^ Apparently -O1 does not perform sufficient optimization to ascertain that PACKET_get_1 will always initialize u if it returns true. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/4518) --- diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index 7f6ffdc3ca..102de24464 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -118,7 +118,7 @@ static int validate_client_hello(BIO *wbio) long len; unsigned char *data; int cookie_found = 0; - unsigned int u; + unsigned int u = 0; len = BIO_get_mem_data(wbio, (char **)&data); if (!PACKET_buf_init(&pkt, data, len))