[libvirt] [PATCH] python: Handle embedded NULL in stream.send data
Eric Blake
eblake at redhat.com
Mon Jul 25 20:28:05 UTC 2011
On 07/25/2011 09:45 AM, Cole Robinson wrote:
NULL refers to the pointer (4 or 8 bytes), NUL refers to the character
(1 byte). Therefore, in the subject line:
s/NULL/NUL/
> Otherwise things like volume upload are only useful with text data.
> ---
> python/libvirt-override.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
I agree that this is a problem that needs to be fixed,
>
> diff --git a/python/libvirt-override.c b/python/libvirt-override.c
> index 9d1dac2..70e0238 100644
> --- a/python/libvirt-override.c
> +++ b/python/libvirt-override.c
> @@ -4151,11 +4151,12 @@ libvirt_virStreamSend(PyObject *self ATTRIBUTE_UNUSED,
> PyObject *pyobj_stream;
> virStreamPtr stream;
> char *data;
> + int datalen;
> int ret;
> int nbytes;
>
> - if (!PyArg_ParseTuple(args, (char *) "Ozi:virStreamRecv",
> -&pyobj_stream,&data,&nbytes)) {
> + if (!PyArg_ParseTuple(args, (char *) "Oz#i:virStreamRecv",
> +&pyobj_stream,&data,&datalen,&nbytes)) {
and although I've never really written any python or C/python
interaction code, this looks on the surface to do what you claim, so:
ACK.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list