You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can see from the CFFI documentation ffi.new_handle(None) produces a cdata object representing a void* pointer and that pointer is associated with None. Not sure if that makes sense at all to associate with None. But what worries me more is that the produced void* pointer is passed as the second argument to zpool_get_config() which actually interprets it as a pointer to a pointer, nvlist_t** and assigns a value to that pointer. I am not sure if it is safe to do that via a pointer returned from ffi.new_handle(). My impression is that such a pointer is never meant to be dereferenced. I think that it can only passed between python and C code and used with ffi.from_handle().
Perhaps ffi.NULL would be better to use here?
The text was updated successfully, but these errors were encountered:
I'm actually not sure anymore why I did new_handle.. but I did some checks and ffi.NULL seems to work fine (and actually sounds more logical). I've also changed it in .list, where the same would apply (there the handle is passed to the iter callback).
I see the following code
here https://github.com/Xaroth/libzfs-python/blob/master/libzfs/zpool.py#L133
As far as I can see from the CFFI documentation ffi.new_handle(None) produces a cdata object representing a void* pointer and that pointer is associated with None. Not sure if that makes sense at all to associate with None. But what worries me more is that the produced void* pointer is passed as the second argument to zpool_get_config() which actually interprets it as a pointer to a pointer, nvlist_t** and assigns a value to that pointer. I am not sure if it is safe to do that via a pointer returned from ffi.new_handle(). My impression is that such a pointer is never meant to be dereferenced. I think that it can only passed between python and C code and used with ffi.from_handle().
Perhaps ffi.NULL would be better to use here?
The text was updated successfully, but these errors were encountered: