Solution proposal for issue #1647.
authorMatthias Kraft <Matthias.Kraft@softwareag.com>
Fri, 30 Sep 2016 08:50:17 +0000 (10:50 +0200)
committerRich Salz <rsalz@openssl.org>
Sun, 13 Nov 2016 03:26:20 +0000 (22:26 -0500)
Avoid a memory alignment issue.

Signed-off-by: Matthias Kraft <Matthias.Kraft@softwareag.com>
CLA: trivial
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1650)

test/bad_dtls_test.c

index 4ee155fcdfc3a0bf0600a1908bb9bdba195159e9..1408a1354e08feaa65115af09d03011dbefdd92c 100644 (file)
@@ -451,6 +451,7 @@ int main(int argc, char *argv[])
     BIO *rbio;
     BIO *wbio;
     BIO *err;
+    time_t now = 0;
     int testresult = 0;
     int ret;
     int i;
@@ -464,7 +465,9 @@ int main(int argc, char *argv[])
     RAND_bytes(master_secret, sizeof(master_secret));
     RAND_bytes(cookie, sizeof(cookie));
     RAND_bytes(server_random + 4, sizeof(server_random) - 4);
-    time((void *)server_random);
+
+    now = time(NULL);
+    memcpy(server_random, &now, sizeof(now));
 
     sess = client_session();
     if (sess == NULL) {