mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Create persistent interned string for password algos
These strings are returned to userland by password_algos(), which violates thread-safety invariants. Create persistent interned strings for them instead.
This commit is contained in:
parent
051ff33660
commit
b0d4d6ebb4
1 changed files with 2 additions and 6 deletions
|
@ -38,12 +38,8 @@
|
|||
static zend_array php_password_algos;
|
||||
|
||||
int php_password_algo_register(const char *ident, const php_password_algo *algo) {
|
||||
zval zalgo;
|
||||
ZVAL_PTR(&zalgo, (php_password_algo*)algo);
|
||||
if (zend_hash_str_add(&php_password_algos, ident, strlen(ident), &zalgo)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return FAILURE;
|
||||
zend_string *key = zend_string_init_interned(ident, strlen(ident), 1);
|
||||
return zend_hash_add_ptr(&php_password_algos, key, (void *) algo) ? SUCCESS : FAILURE;
|
||||
}
|
||||
|
||||
void php_password_algo_unregister(const char *ident) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue