The branch master has been updated
       via  649cfb5cbb78e3c4c91ceb65fad2a4daad6047dd (commit)
      from  405988f2cca816fdfdf8ad62b1285dcf06822e85 (commit)


- Log -----------------------------------------------------------------
commit 649cfb5cbb78e3c4c91ceb65fad2a4daad6047dd
Author: Viktor Dukhovni <openssl-us...@dukhovni.org>
Date:   Wed Feb 21 08:25:49 2018 -0500

    Use malloc to avoid alignment problems.
    
    Thanks to Norm Green for reporting this issue.
    
    Signed-off-by: Rich Salz <rs...@openssl.org>
    
    Reviewed-by: Richard Levitte <levi...@openssl.org>
    Reviewed-by: Rich Salz <rs...@openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5423)

-----------------------------------------------------------------------

Summary of changes:
 test/asn1_encode_test.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/asn1_encode_test.c b/test/asn1_encode_test.c
index e9f459a..1ae0519 100644
--- a/test/asn1_encode_test.c
+++ b/test/asn1_encode_test.c
@@ -709,15 +709,18 @@ static int do_encode_custom(EXPECTED *input,
 static int do_print_item(const TEST_PACKAGE *package)
 {
 #define DATA_BUF_SIZE 256
-    unsigned char buf[DATA_BUF_SIZE];
     const ASN1_ITEM *i = ASN1_ITEM_ptr(package->asn1_type);
-    ASN1_VALUE *o = (ASN1_VALUE *)&buf;
+    ASN1_VALUE *o;
     int ret;
 
     OPENSSL_assert(package->encode_expectations_elem_size <= DATA_BUF_SIZE);
+    if ((o = OPENSSL_malloc(DATA_BUF_SIZE)) == NULL)
+        return 0;
 
-    (void)RAND_bytes(buf, (int)package->encode_expectations_elem_size);
+    (void)RAND_bytes((unsigned char*)o,
+                     (int)package->encode_expectations_elem_size);
     ret = ASN1_item_print(bio_err, o, 0, i, NULL);
+    OPENSSL_free(o);
 
     return ret;
 }
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to