Fix memory corruption when cloning objects by disallowing clone

This commit is contained in:
Jakub Zelenka 2026-11-22 14:04:45 +01:00
commit f8ea5648b3
No known key found for this signature in database
GPG key ID: 1C0779DC5C0A9DE4
2 changed files with 2 additions and 0 deletions

View file

@ -533,6 +533,7 @@ PHP_MINIT_FUNCTION(gnupg)
memcpy(&gnupg_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
gnupg_object_handlers.offset = offsetof(gnupg_object, std);
gnupg_object_handlers.free_obj = gnupg_object_free;
gnupg_object_handlers.clone_obj = NULL;
if (SUCCESS != gnupg_keylistiterator_init(type, module_number)) {
return FAILURE;

View file

@ -136,6 +136,7 @@ int gnupg_keylistiterator_init(INIT_FUNC_ARGS)
memcpy(&gnupg_keylistiterator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
gnupg_keylistiterator_handlers.offset = offsetof(gnupg_keylistiterator_object, std);
gnupg_keylistiterator_handlers.free_obj = gnupg_keylistiterator_object_free;
gnupg_keylistiterator_handlers.clone_obj = NULL;
zend_class_implements(gnupg_keylistiterator_class_entry, 1, zend_ce_iterator);