diff options
author | tb <> | 2025-06-07 04:37:01 +0000 |
---|---|---|
committer | tb <> | 2025-06-07 04:37:01 +0000 |
commit | 23906d429d230b3a4ab10ff682d2422a4adfa257 (patch) | |
tree | 0e40867c230d001cd1f57dc6c686ed65a80a2362 /src/lib/libcrypto | |
parent | 96a76161020b928e1e01f56826e2cdd5bb4adf3f (diff) | |
download | openbsd-23906d429d230b3a4ab10ff682d2422a4adfa257.tar.gz openbsd-23906d429d230b3a4ab10ff682d2422a4adfa257.tar.bz2 openbsd-23906d429d230b3a4ab10ff682d2422a4adfa257.zip |
crypto_ex_data: fix allocation size of classes_new
classes_new is an array of pointers to struct crypto_ex_data, not
an array of struct crypto_ex_data_index, so this overallocated by
240 or 480 bytes on ILP32 or LP64, respectively.
found by jsg using smatch
ok jsing
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r-- | src/lib/libcrypto/crypto_ex_data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c index ceb3a92e51..b195bbd223 100644 --- a/src/lib/libcrypto/crypto_ex_data.c +++ b/src/lib/libcrypto/crypto_ex_data.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crypto_ex_data.c,v 1.4 2024/08/03 07:45:26 tb Exp $ */ | 1 | /* $OpenBSD: crypto_ex_data.c,v 1.5 2025/06/07 04:37:01 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -52,7 +52,7 @@ crypto_ex_data_classes_init(void) | |||
52 | return 1; | 52 | return 1; |
53 | 53 | ||
54 | if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, | 54 | if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, |
55 | sizeof(struct crypto_ex_data_index))) == NULL) | 55 | sizeof(*classes_new))) == NULL) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); | 58 | CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); |