From a2fc8feb4c498cd429cb4f1b3945ff7c54160fb5 Mon Sep 17 00:00:00 2001 From: Arshid Date: Sat, 14 Mar 2026 10:43:55 +0530 Subject: [PATCH] ext/openssl: openssl: use zend_string_init() instead of manual allocation (#21436) --- ext/openssl/openssl_backend_v3.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ext/openssl/openssl_backend_v3.c b/ext/openssl/openssl_backend_v3.c index cd190546d50..6e3e883080f 100644 --- a/ext/openssl/openssl_backend_v3.c +++ b/ext/openssl/openssl_backend_v3.c @@ -567,10 +567,7 @@ static zend_string *php_openssl_get_utf8_param( char buf[64]; size_t len; if (EVP_PKEY_get_utf8_string_param(pkey, param, buf, sizeof(buf), &len) > 0) { - zend_string *str = zend_string_alloc(len, 0); - memcpy(ZSTR_VAL(str), buf, len); - ZSTR_VAL(str)[len] = '\0'; - return str; + return zend_string_init(buf, len, 0); } return NULL; }