Commit b844df54f1 for openssl.org

commit b844df54f1f8147ac7fe90ac83613a55c5656682
Author: Bob Beck <beck@openssl.org>
Date:   Wed Aug 5 14:24:58 2026 -0600

    Don't assume an ASN1_STRING is nul byte terminated in the test

    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Andrew Dinh <andrewd@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Merge-date: Thu Aug 27 13:52:46 2026
    Merged-from: https://github.com/openssl/openssl/pull/32178

diff --git a/test/asn1_time_test.c b/test/asn1_time_test.c
index 19ec1c3aa9..a761c0d801 100644
--- a/test/asn1_time_test.c
+++ b/test/asn1_time_test.c
@@ -674,7 +674,7 @@ static int test_table(struct testdata *tbl, int idx)
     int day, sec;

     atime.data = (unsigned char *)td->data;
-    atime.length = (int)strlen((char *)atime.data);
+    atime.length = (int)strlen(td->data);
     atime.type = td->type;
     atime.flags = 0;

@@ -719,8 +719,8 @@ static int test_table(struct testdata *tbl, int idx)
     } else {
         int local_error = 0;
         if (!TEST_int_eq(ASN1_TIME_cmp_time_t(ptime, td->t), 0)) {
-            TEST_info("ASN1_TIME_set(%ld) compare failed (%s->%s)",
-                (long)td->t, td->data, ptime->data);
+            TEST_info("ASN1_TIME_set(%ld) compare failed (%s->%.*s)",
+                (long)td->t, td->data, ptime->length, ptime->data);
             local_error = error = 1;
         }
         if (!TEST_int_eq(ptime->type, td->expected_type)) {
@@ -728,7 +728,7 @@ static int test_table(struct testdata *tbl, int idx)
             local_error = error = 1;
         }
         if (local_error)
-            TEST_info("ASN1_TIME_set() = %*s", ptime->length, ptime->data);
+            TEST_info("ASN1_TIME_set() = %.*s", ptime->length, ptime->data);
         ASN1_TIME_free(ptime);
     }

@@ -760,7 +760,7 @@ static int test_table(struct testdata *tbl, int idx)
             local_error = error = 1;
         }
         if (local_error)
-            TEST_info("ASN1_TIME_set_string_gmt() = %*s", ptime->length, ptime->data);
+            TEST_info("ASN1_TIME_set_string_gmt() = %.*s", ptime->length, ptime->data);
         ASN1_TIME_free(ptime);
     }

@@ -784,7 +784,7 @@ static int test_table(struct testdata *tbl, int idx)
             local_error = error = 1;
         }
         if (local_error)
-            TEST_info("ASN1_TIME_set_string() = %*s", ptime->length, ptime->data);
+            TEST_info("ASN1_TIME_set_string() = %.*s", ptime->length, ptime->data);
         ASN1_TIME_free(ptime);
     }

@@ -798,7 +798,8 @@ static int test_table(struct testdata *tbl, int idx)
             error = 1;
         }
         if (ptime != NULL && !TEST_int_eq(ASN1_TIME_cmp_time_t(ptime, td->t), 0)) {
-            TEST_info("ASN1_TIME_to_generalizedtime(%s->%s) bad result", atime.data, ptime->data);
+            TEST_info("ASN1_TIME_to_generalizedtime(%s->%.*s) bad result", atime.data,
+                ptime->length, ptime->data);
             error = 1;
         }
         ASN1_TIME_free(ptime);