From 23906d429d230b3a4ab10ff682d2422a4adfa257 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 7 Jun 2025 04:37:01 +0000 Subject: 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 --- src/lib/libcrypto/crypto_ex_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: crypto_ex_data.c,v 1.4 2024/08/03 07:45:26 tb Exp $ */ +/* $OpenBSD: crypto_ex_data.c,v 1.5 2025/06/07 04:37:01 tb Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -52,7 +52,7 @@ crypto_ex_data_classes_init(void) return 1; if ((classes_new = calloc(CRYPTO_EX_INDEX__COUNT, - sizeof(struct crypto_ex_data_index))) == NULL) + sizeof(*classes_new))) == NULL) return 0; CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); -- cgit v1.2.3-55-g6feb