Re: [PATCH] python: Handle embedded NULL in stream.send data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]