diff mbox

[2/4] correct libxl_write_exactly sizeof

Message ID 1460022028-25174-3-git-send-email-cyliu@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chunyan Liu April 7, 2016, 9:40 a.m. UTC
sizeof is wrongly used in libxl_write_exactly function, using
strlen instead.

CID: 1358110
CID: 1358109

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxl_pvusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ian Jackson April 7, 2016, 4:46 p.m. UTC | #1
Chunyan Liu writes ("[PATCH 2/4] correct libxl_write_exactly sizeof"):
> sizeof is wrongly used in libxl_write_exactly function, using
> strlen instead.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

thanks,
Ian.
diff mbox

Patch

diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
index 04e41b4..45117cf 100644
--- a/tools/libxl/libxl_pvusb.c
+++ b/tools/libxl/libxl_pvusb.c
@@ -1025,7 +1025,7 @@  static int unbind_usbintf(libxl__gc *gc, const char *intf)
         goto out;
     }
 
-    if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) {
+    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) {
         rc = ERROR_FAIL;
         goto out;
     }
@@ -1065,7 +1065,7 @@  static int bind_usbintf(libxl__gc *gc, const char *intf, const char *drvpath)
         goto out;
     }
 
-    if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) {
+    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) {
         rc = ERROR_FAIL;
         goto out;
     }