From: Eugene Syromiatnikov Date: Thu, 17 Jul 2025 08:41:07 +0000 (+0200) Subject: ssl: drop multiplication by sizeof(char) in allocation size calculations X-Git-Tag: openssl-3.6.0-alpha1~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4a91d5c26141a9bc786870ba9e58f59e3b23f96;p=thirdparty%2Fopenssl.git ssl: drop multiplication by sizeof(char) in allocation size calculations Signed-off-by: Eugene Syromiatnikov Reviewed-by: Saša Nedvědický Reviewed-by: Matt Caswell Reviewed-by: Paul Dale Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/28059) --- diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 96bbbdb8768..0e245b1c27e 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -1334,9 +1334,10 @@ static int gid_cb(const char *elem, int len, void *arg) * First, we restore any keyshare prefix in a new zero-terminated string * (if not already present) */ - restored_default_group_string = OPENSSL_malloc((1 /* max prefix length */ + - strlen(default_group_strings[i].group_string) + - 1 /* \0 */) * sizeof(char)); + restored_default_group_string = + OPENSSL_malloc(1 /* max prefix length */ + + strlen(default_group_strings[i].group_string) + + 1 /* \0 */); if (restored_default_group_string == NULL) return 0; if (add_keyshare @@ -1552,7 +1553,7 @@ static int tuple_cb(const char *tuple, int len, void *arg) } /* Convert to \0-terminated string */ - restored_tuple_string = OPENSSL_malloc((len + 1 /* \0 */) * sizeof(char)); + restored_tuple_string = OPENSSL_malloc(len + 1 /* \0 */); if (restored_tuple_string == NULL) return 0; memcpy(restored_tuple_string, tuple, len);