[libvirt] [PATCH php v2] Fix crash in VIRT_HASH_CURRENT_KEY_INFO macro
Michal Privoznik
mprivozn at redhat.com
Thu Dec 7 07:28:53 UTC 2017
On 12/06/2017 05:54 PM, Dawid Zamirski wrote:
> The PHP7 variant of the macro wasn't safe if the hash key was not a
> string type. This was found when running php script with just
> libvirt_connect call under xdebug session which segfaulted. This patch
> makes the following changes:
>
> * make sure that tmp_name is initialized to NULL
> * set the key name only when zend_hash_get_current_key_ex did set it to
> something which happens only when type is HASH_KEY_IS_STRING
> * stash the key index in out php_libvirt_hash_key_info struct because it
> wasn't there before and separate variable had to be used.
> ---
>
> v1: https://www.redhat.com/archives/libvir-list/2017-December/msg00151.html
>
> Changes since v1:
> * use zend_ulong in php_libvirt_hash_key_info struct so that no type
> cast is needed
>
> src/libvirt-connection.c | 8 +++-----
> src/libvirt-php.c | 6 ++----
> src/libvirt-php.h | 1 +
> src/util.h | 16 +++++++++-------
> 4 files changed, 15 insertions(+), 16 deletions(-)
ACKed and pushed.
Michal
More information about the libvir-list
mailing list