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:22:21 +0000 (22:22 -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)

ssl/bad_dtls_test.c

index d42817fc329e6901c8a91cb47a63a98a8b191b73..70d8578b588317497e5a222a4ad6a1c597a30462 100644 (file)
@@ -756,6 +756,7 @@ int main(int argc, char *argv[])
     BIO *rbio;
     BIO *wbio;
     BIO *err;
+    time_t now = 0;
     int testresult = 0;
     int ret;
     int i;
@@ -773,7 +774,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) {