[libvirt] [PATCH] python: Handle embedded NULL in stream.send data
Cole Robinson
crobinso at redhat.com
Mon Jul 25 21:28:53 UTC 2011
On 07/25/2011 04:28 PM, Eric Blake wrote:
> 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.
>
Thanks, pushed now with the amended subject.
- Cole
More information about the libvir-list
mailing list