Skip to content

Commit 4f5f41b

Browse files
committed
ext/openssl: openssl: use zend_string_init() instead of manual allocation
1 parent c658d3c commit 4f5f41b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ext/openssl/openssl_backend_v3.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,7 @@ static zend_string *php_openssl_get_utf8_param(
567567
char buf[64];
568568
size_t len;
569569
if (EVP_PKEY_get_utf8_string_param(pkey, param, buf, sizeof(buf), &len) > 0) {
570-
zend_string *str = zend_string_alloc(len, 0);
571-
memcpy(ZSTR_VAL(str), buf, len);
572-
ZSTR_VAL(str)[len] = '\0';
573-
return str;
570+
return zend_string_init(buf, len, 0);
574571
}
575572
return NULL;
576573
}

0 commit comments

Comments
 (0)