1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/openssl: openssl: use zend_string_init() instead of manual allocation (#21436)

This commit is contained in:
Arshid
2026-03-14 10:43:55 +05:30
committed by GitHub
parent 92ba1e4ea0
commit a2fc8feb4c

View File

@@ -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;
}