summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/regress/lib/libcrypto/bn/general/bn_unit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/bn/general/bn_unit.c b/src/regress/lib/libcrypto/bn/general/bn_unit.c
index f1a2c780f7..6ae6765998 100644
--- a/src/regress/lib/libcrypto/bn/general/bn_unit.c
+++ b/src/regress/lib/libcrypto/bn/general/bn_unit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_unit.c,v 1.3 2022/11/23 08:01:05 tb Exp $ */ 1/* $OpenBSD: bn_unit.c,v 1.4 2022/11/23 08:58:34 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
@@ -45,6 +45,7 @@ test_bn_print_null_derefs(void)
45 size_t size = INT_MAX / 4 + 4; 45 size_t size = INT_MAX / 4 + 4;
46 size_t datalimit = (size + 500 * 1024) / 1024; 46 size_t datalimit = (size + 500 * 1024) / 1024;
47 char *a; 47 char *a;
48 char digit;
48 int failed = 0; 49 int failed = 0;
49 50
50 if ((a = malloc(size)) == NULL) { 51 if ((a = malloc(size)) == NULL) {
@@ -53,7 +54,10 @@ test_bn_print_null_derefs(void)
53 return 0; 54 return 0;
54 } 55 }
55 56
56 memset(a, '0', size - 1); 57 /* Fill with a random digit since coverity doesn't like us using '0'. */
58 digit = '0' + arc4random_uniform(10);
59
60 memset(a, digit, size - 1);
57 a[size - 1] = '\0'; 61 a[size - 1] = '\0';
58 62
59 failed |= test_bn_print_wrapper(a, size, "BN_dec2bn", BN_dec2bn); 63 failed |= test_bn_print_wrapper(a, size, "BN_dec2bn", BN_dec2bn);